ORACLE数据库操作手册

合集下载

超详细oracle教程菜鸟入门手册

超详细oracle教程菜鸟入门手册

超详细oracle教程菜鸟入门手册1. 什么是Oracle数据库Oracle数据库是全球领先的关系型数据库管理系统之一,被广泛应用于数据存储、数据处理和数据分析领域。

Oracle数据库可以在多种操作系统上运行,包括Windows、Linux、UNIX等。

Oracle数据库提供了丰富的功能和工具,支持高并发、高可用、高安全的数据存储和处理。

2. Oracle数据库的安装## 2.1 下载Oracle数据库安装包在Oracle官网下载对应版本的Oracle数据库安装包,根据操作系统选择对应的版本。

## 2.2 安装Oracle数据库双击安装包,按照提示进行安装。

需要注意的是,在安装过程中需要设置管理员账号和密码,以及数据库实例名称等信息。

## 2.3 配置Oracle数据库安装完成后,需要进行一些配置工作,包括设置环境变量、创建监听器等。

具体步骤可以参考Oracle官方文档。

3. Oracle数据库的基本操作## 3.1 登录Oracle数据库使用SQL*Plus或其他数据库管理工具登录Oracle数据库,输入管理员账号和密码即可。

## 3.2 创建表使用CREATE TABLE语句创建表,指定表名、字段名、数据类型等信息。

## 3.3 插入数据使用INSERT INTO语句插入数据,指定表名和插入的数据内容。

## 3.4 查询数据使用SELECT语句查询数据,可以指定查询条件、排序方式等。

## 3.5 更新数据使用UPDATE语句更新数据,可以指定更新条件和更新的数据内容。

## 3.6 删除数据使用DELETE语句删除数据,可以指定删除条件。

4. Oracle数据库的高级功能## 4.1 数据库备份和恢复Oracle数据库支持多种备份和恢复方式,包括数据文件备份、在线备份、冷备份等。

在数据库出现故障或数据丢失的情况下,可以通过备份文件进行恢复。

## 4.2 数据库性能优化Oracle数据库提供了多种性能优化工具,包括AWR报告、SQL调优等。

oracle12c操作手册

oracle12c操作手册

oracle12c操作手册摘要:I.简介- Oracle 12c 简介- 安装Oracle 12c 的准备工作II.安装Oracle 12c- 安装环境要求- 解压缩文件- 运行安装向导- 安装选项- 完成安装III.Oracle 12c 数据库管理- 数据库创建与管理- 表空间管理- 数据表管理- 用户与权限管理IV.Oracle 12c 数据库查询与维护- SQL 查询语言- 数据备份与恢复- 数据库性能优化- 常见问题及解决方案V.总结- Oracle 12c 的优点与不足- 对Oracle 12c 的展望正文:I.简介Oracle 12c 是Oracle 公司于2013 年发布的一款关系型数据库管理系统,它具有高性能、高可靠性、高安全性等特点,被广泛应用于企业级数据库领域。

本文将为您介绍Oracle 12c 的安装与使用方法。

II.安装Oracle 12c在安装Oracle 12c 之前,您需要确保您的系统满足以下条件:- 操作系统:Windows 7 以上版本- 内存:8GB 以上- 硬盘:20GB 以上准备好以上条件后,您可以下载Oracle 12c 安装包,并解压缩到任意目录。

然后双击运行解压缩后的安装向导程序,按照提示进行操作。

在安装过程中,您需要选择安装选项,这里建议选择“桌面类”安装方式,以满足一般用户的需求。

III.Oracle 12c 数据库管理在成功安装Oracle 12c 后,您可以开始创建和管理数据库。

首先,通过SQL*Plus 或其他工具连接到数据库,然后使用CREATE DATABASE 语句创建数据库。

接下来,您可以创建表空间、数据表,并为用户分配权限。

IV.Oracle 12c 数据库查询与维护Oracle 12c 提供了强大的查询与维护功能。

您可以使用SQL 语言对数据库进行查询、插入、更新和删除等操作。

此外,Oracle 12c 还支持数据备份与恢复功能,以保障数据的安全性。

oracle19c使用手册

oracle19c使用手册

Oracle Database 19c使用手册一、概述Oracle Database 19c是一个稳定、可靠、高性能的关系数据库管理系统,它支持各种规模的企业应用,可以处理大量数据,并提供各种安全性和可靠性保证。

二、安装与配置1. 安装环境要求Oracle Database 19c的安装环境需要满足一定的硬件和软件要求,包括处理器、内存、存储空间等。

用户需要根据自己的需求选择合适的硬件平台和操作系统。

2. 安装过程Oracle Database 19c的安装过程相对简单,用户可以按照Oracle官方提供的安装指南进行操作。

在安装过程中,用户需要选择合适的安装类型、配置参数以及安装组件等。

3. 配置与管理安装完成后,用户需要对数据库进行配置和管理,包括内存参数、磁盘空间、网络连接等。

用户可以通过Oracle提供的工具和命令进行相应的配置和管理。

三、管理维护1. 用户与权限管理Oracle Database 19c提供了强大的用户与权限管理功能,用户可以根据需要创建和管理数据库用户,并为其分配相应的权限。

2. 数据库备份与恢复为了确保数据的安全性,用户需要定期对数据库进行备份,并在需要时进行恢复。

Oracle Database 19c提供了多种备份和恢复策略,用户可以根据自己的需求选择合适的方案。

3. 日志文件管理数据库运行过程中会产生大量的日志文件,包括重做日志文件、归档日志文件等。

用户需要定期检查和管理这些日志文件,以确保数据库的正常运行。

4. 性能监控与优化为了确保数据库的性能和稳定性,用户需要定期监控数据库的性能指标,如CPU利用率、内存使用情况、磁盘等。

同时,用户还需要对数据库进行优化,包括调整配置参数、优化查询语句等。

四、性能优化1. 索引优化索引是提高数据库查询性能的重要手段之一。

用户需要根据查询需求合理创建和使用索引,避免不必要的全表扫描操作。

2. 查询优化查询语句的写法对数据库性能的影响非常大。

(完整版)Oracle数据库备份和恢复操作手册.doc

(完整版)Oracle数据库备份和恢复操作手册.doc

1ORACLE 数据库数据备份和恢复操作手册1.1. ORACLE 参数设置进入 CMD 操作界面,使用sqlplus 连接数据库,图例 1 数据库连接操作连接语法: sqlplus system/Oracle2013@orcl参数说明参数说明备注sqlplus 语法命令system 数据库管理员用户名Oracle2013 system 用户密码数据库安装目录的tnsnames.ora 文件中可以找到orcl 数据库连接标示符Oracle11G 目录:C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMIN图例 2 成功连接数据库环境变量设置 (在 Sqlplus 中执行 )create or replace directory <dir_name> as‘c:\tmpdir’;参数说明参数说明备注dir_name c:\tmpdir 路径名称文件路径也可以是另外的随意目录,用单引号括起来。

图例 3 环境变量设置1.2.数据备份备份脚本: expdp system/Oracle2013@orcl directory=file_pathdumpfile=ARADMIN.dat logfile=ARADMIN.log schemas=ARADMIN参数说明参数说明备注expdp 语法命令system 数据库管理员用户名Oracle2013 system 用户密码数据库安装目录的 tnsnames.ora 文件中可以找到orcl 数据库连接标示符Oracle11G 目录:C:\app\Administrator\product\11.2.0\dbhome_1\NETWORK\ADMINdirectory 文件目录名称导出数据库文件的存放目录dumpfile 数据库文件名称导出数据库文件的文件名logfile 数据库日志文件名称导出数据库的日志文件名称schemas 数据库用户操作:图例 4 数据库备份操作成功导出。

oracle数据库安全加固操作手册

oracle数据库安全加固操作手册

1.支持按用户分配账号。

结果:现网已实现2.与设备运行、维护等工作无关的账号,应能够删除或锁定。

结果:现网已实现3.应按照用户分配账号。

避免不同用户间共享账号。

避免用户账号和设备间通信使用的账号共享。

结果:现网已实现4.应删除或锁定与设备运行、维护等工作无关的账号。

结果:现网已实现5.限制具备数据库超级管理员(SYSDBA)权限的用户远程登录。

结果:可以实现,但是需要需要重起数据库,影响业务,不建议实现,而且通过防火墙限制访问数据库的端口方式已经实现。

6.对于采用静态口令认证技术的设备,应支持数字、小写字母、大写字母和特殊符号4类字符构成的口令。

应支持配置口令复杂度。

在配置了复杂度后,设备自动拒绝用户设置不符合复杂度要求的口令结果:部分账号已实现(system和CS车务通),其他账号实施时需要重新配置现网的应用配置,影响业务,不建议实现。

7.对于采用静态口令认证技术的设备,应支持配置用户连续认证失败次数上限。

当用户连续认证失败次数超过上限时,设备自动锁定该用户账号。

必须由其他账号,通常为具有管理员权限的账号,才可以解除该账号锁定结果:现网已实现(系统默认是10次)8.对于采用静态口令认证技术的设备,应支持按天配置口令生存期功能。

在配置了口令生存期后,设备在口令超过生存期的用户登录时,应提示并强迫该用户设置新口令结果:可以实现,但是应用账号不建议实现,将会影响应用系统;编号:安全要求-设备-ORACLE-配置-10-可选9.对于采用静态口令认证技术的设备,应支持配置用户不得重复使用其最近已用口令的功能。

当配置相应功能后,设备拒绝用户重复使用在限制次数内的口令结果:可以实现,但是应用账号不建议实现,将会影响应用系统;见问题8的实现10.对于采用静态口令认证技术的设备,应配置当用户连续认证失败次数超过6次(不含6次),锁定该用户使用的账号结果:现网已实现(系统默认是10次)11.对于存在关系型数据库的设备,设备应支持对数据库表,给不同数据库用户或用户组分别授予读取、修改的权限。

oracle中文使用手册

oracle中文使用手册

oracle中文使用手册Oracle是一款功能强大的关系型数据库管理系统,广泛应用于企业数据管理和应用开发领域。

本手册将详细介绍Oracle数据库的基本概念、常用命令和操作方法,以帮助初学者快速上手和熟练使用Oracle。

1. Oracle简介Oracle是美国Oracle公司开发的一种关系型数据库管理系统。

它是目前企业级应用系统首选的数据库产品之一,被广泛应用于各个行业的数据管理和应用开发中。

Oracle具有可靠性高、性能优异、安全性强等特点,成为大型企业数据处理的首选。

2. 安装与配置在开始使用Oracle之前,首先需要进行安装和配置。

可以从Oracle官方网站下载安装程序,根据提示进行安装。

安装完成后,需要进行一些基本的配置,如创建数据库实例、设置监听器等。

详细的安装和配置过程可以参考Oracle官方提供的文档或手册。

3. 数据库连接与登录使用Oracle数据库前,需要先进行数据库连接和登录。

可以使用SQL*Plus命令行工具或Oracle SQL Developer等图形化界面工具来进行连接和登录。

在连接时需要提供数据库的主机名、端口号和SID等信息,以及合法的用户名和密码。

连接成功后,即可开始对数据库进行操作。

4. SQL基本操作SQL是结构化查询语言,用于在关系型数据库中进行数据的增删改查等操作。

下面介绍一些常用的SQL命令:- 创建表: 使用CREATE TABLE语句可以创建数据表,并指定表的字段、数据类型、约束等信息。

- 插入数据: 使用INSERT INTO语句可以向表中插入数据。

- 更新数据: 使用UPDATE语句可以更新表中的数据。

- 删除数据: 使用DELETE FROM语句可以删除表中的数据。

- 查询数据: 使用SELECT语句可以查询表中的数据。

5. 数据库事务和锁机制数据库事务是指对数据库进行的一系列操作,要么全部执行成功,要么全部不执行。

Oracle提供了事务管理机制,可以确保数据库的一致性和完整性。

oracle导入数据库操作手册

oracle导入数据库操作手册

打开flashFXP,点击N型符号或者F8快捷键,打开快速连接面板。

服务器、用户名填写如下,密码为gogo8888,然后点击连接,出现图一所示。

图一连接成功后,进入如下图二目录,图二把待导入数据库拖至图三A区域所示区域,则会在B区域显示待上传文件路径,在B区域路径连接上点击鼠标右键,选择“传送队列”,等待上传完毕,则文件显示在A区域,说明上传完毕。

图三打开oracle企业管理器,添加数据库,参数如如图四点击确定建立数据库,然后进入刚才建好的数据库,登陆界面如图五,注意用户名和连接身份,口令为SYS8888。

图五在新建数据库依次打开“安全性”—>“用户”,在“用户”上右键点击“创建”,打开创建用户界面,如图六,名称一般命名为“LIS+日期”,口令设置为与命名相同,默认值设置为LIS,临时设置为TEMP。

同时要设置角色和系统。

“角色”选择为“DBA”, ,左边符号为添加符号,把选择的角色添加进来。

图七“系统”选择为“UNLIMITED TABLESPACE”,同“角色”一样添加进来。

设置完用户后“创建”建立用户。

创建完用户后开始导库过程。

打开“运行”,输入”telnet 10.0.5.201”,打开telnet命令提示符界面,然后依次运行数据库登陆,进入数据库目录,以及导库命令,参考图八,其中login 输入oracle,password输入gogo8888,$符号后ls为打开列表,cd为进入(类似于cmd操作命令)。

导库命令为:imp lis0423/lis0423 file=lis_0423.dmp log=lis0423.log fromuser=lis touser=lis0423。

图八最后出现图九,导库成功。

图九。

Oracle数据库21c版本使用指南说明书

Oracle数据库21c版本使用指南说明书

Business / Technical BriefGetting Started with the Oracle Compression AdvisorMarch, 2023, Version 21.4Copyright © 2023, Oracle and/or its affiliatesPublicPurpose statementThis document provides an overview of features and enhancements included in release Oracle Database 21c. It is intended solely to help you assess the business benefits of upgrading to Oracle Database 21c and to plan your I.T. projects. DisclaimerThis document in any form, software, or printed matter, contains proprietary information that is the exclusive property of Oracle. Your access to and use of this confidential material is subject to the terms and conditions of your Oracle software license and service agreement, which has been executed and with which you agree to comply. This document and information contained herein may not be disclosed, copied, reproduced, or distributed to anyone outside Oracle without prior written consent of Oracle. This document is not part of your license agreement nor can it be incorporated into any contractual agreement with Oracle or its subsidiaries or affiliates.This document is for informational purposes only and is intended solely to assist you in planning for the implementation and upgrade of the product features described. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described in this document remains at the sole discretion of Oracle. Due to the nature of the product architecture, it may not be possible to safely include all features described in this document without risking significant destabilization of the code.Table of contentsPurpose statement2 Disclaimer2 Introduction4 Compression Advisor4 Using the GET_COMPRESSION_RATIO Procedure5 Usage Examples6 Understanding Compression Advisor Results10 Compression Advisor Best Practices11 More Information11IntroductionOracle Advanced Compression includes a comprehensive set of compression capabilities to help organizations maximize resource utilization and reduce costs. It allows IT administrators to significantly reduce their overall database storage footprint, and improve performance, by enabling compression for all types of data, including:Advanced Row CompressionEnables table data to be compressed during all types of data manipulation operations, including DML INSERT and UPDATE operations -- intelligent algorithm minimizes compression overhead during write operations, thereby making compression viable for both data warehouse and OLTP workloads.Advanced LOB CompressionProvides compression for LOB segments managed by Oracle SecureFiles – a high performance and powerful infrastructure for managing unstructured data such as images, documents, videos and more.Advanced Index CompressionReduces the size of all supported unique and non-unique indexes- Advanced Index Compression HIGH automatically chooses the right compression per index block. Advanced Index Compression provides significant space savings while also improving performance for queries that are executed using indexes.Compression AdvisorAn easy way to get started, with Advanced Compression, is by using the free compression advisor. The “DBMS_COMPRESSION” PL/SQL package (commonly called compression advisor) gathers compression-related information within a database environment. This includes estimating the compressibility of both uncompressed partitioned, and non-partitioned tables, and gathering row-level compression information on previously compressed tables/partitions. Compression advisor provides organizations with the storage reduction information needed to make compression-related usage decisions.The output of running compression advisor is an estimation of the compression ratio, for the specific table, that was the target of compression advisor. The output indicates the “COMPRESSION RATIO” presented as a number such as 2.1. This number indicates that, for this specific table or partition, the estimated compression ratio is 2.1x, which represents about a 50% reduction in the footprint of the table or partition should compression be enabled.The compression ratio achieved in a given environment depends on the data being compressed, specifically the cardinality of the data. In general, organizations can expect to reduce their storage space consumption by a factor of 2x to 4x by using Advanced Row Compression. That is, the amount of space consumed by uncompressed data will be two to four times larger than that of the compressed data.A version of compression advisor, which supports Oracle Database 9i Release 2 through 11g Release 1, is available on the Advanced Compression page on . This version can only report the compression ratio for data tables – those tables (and partitions) that would be targets for OLTP Table Compression. Another version of the DBMS_COMPRESSION PL/SQL package is included with Oracle Database 11g Release 2 and above. This version can report the compression ratio for data tables (targets for Advanced RowCompression), LOB segments managed by SecureFiles (targets for Advanced LOB Compression) and indexes (targets for Advanced Index Compression).Compression Advisor is free to use with Oracle Database Enterprise Edition.Using the GET_COMPRESSION_RATIO ProcedureWhen using the GET_COMPRESSION_RATIO procedure to estimate compression ratios, different constants are specified as parameters, these include:GET_COMPRESSION_RATIO Procedure ParametersPlease see the Oracle Database documentation for additional information.Usage ExamplesBelow are syntax examples, of the GET_COMPRESSION_RATIO procedure, to estimate the compression ratio of a data table, index, and LOB.Syntax for GET_COMPRESSION_RATIO for a data table and indexes:Example: Estimating Compression Ratio for Advanced Row CompressionSET SERVEROUTPUT ONDECLAREblkcnt_cmp PLS_INTEGER;blkcnt_uncmp PLS_INTEGER;row_cmp PLS_INTEGER;row_uncmp PLS_INTEGER;cmp_ratio NUMBER;comptype_str VARCHAR2(32767);Output of Compression Advisor Estimate for Advanced Row Compression (Entire Table) Number of blocks used by the compressed sample of the object: 165Number of blocks used by the uncompressed sample of the object: 629Number of rows in a block in compressed sample of the object: 599Number of rows in a block in uncompressed sample of the object: 157Estimated Compression Ratio of Sample: 3.8Compression Type: “Compress Advanced”Example: Estimating Compression Ratio for Advanced Index Compression (LOW)SET SERVEROUTPUT ONDECLAREblkcnt_cmp PLS_INTEGER;blkcnt_uncmp PLS_INTEGER;row_cmp PLS_INTEGER;row_uncmp PLS_INTEGER;cmp_ratio NUMBER;comptype_str VARCHAR2(32767);BEGINDBMS_COMPRESSION.GET_COMPRESSION_RATIO (scratchtbsname=> 'USERS' ,ownname=> 'TEST' ,objname=> 'SALES_IDX' ,subobjname=> NULL ,comptype=> DBMS_P_INDEX_ADVANCED_LOW,blkcnt_cmp=> blkcnt_cmp,blkcnt_uncmp=> blkcnt_uncmp,row_cmp=> row_cmp,row_uncmp=> row_uncmp,cmp_ratio=> cmp_ratio,comptype_str=> comptype_str,subset_numrows=> DBMS_p_ratio_minrows,objtype=> DBMS_COMPRESSION.objtype_index);DBMS_OUTPUT.put_line( 'Number of blocks used by the compressed sample of the object: ' || blkcnt_cmp);DBMS_OUTPUT.put_line( 'Number of blocks used by the uncompressed sample of the object: ' || blkcnt_uncmp);DBMS_OUTPUT.put_line( 'Number of rows in a block in compressed sample of the object: ' || row_cmp);DBMS_OUTPUT.put_line( 'Number of rows in a block in uncompressed sample of the object: ' || row_uncmp);DBMS_OUTPUT.put_line ('Estimated Compression Ratio of Sample : ' || cmp_ratio);DBMS_OUTPUT.put_line( 'Compression Type: ' || comptype_str);END;/Output of Compression Advisor Estimate for Advanced Index Compression (LOW)Number of blocks used by the compressed sample of the object: 243Number of blocks used by the uncompressed sample of the object: 539Number of rows in a block in compressed sample of the object: 499Number of rows in a block in uncompressed sample of the object: 145Estimated Compression Ratio of Sample: 2.2Compression Type: “Compress Advanced Low”Syntax for GET_COMPRESSION_RATIO for LOBs:Example: Estimating Compression Ratio for Advanced LOB Compression (MEDIUM)SET SERVEROUTPUT ONDECLAREblkcnt_cmp PLS_INTEGER;blkcnt_uncmp PLS_INTEGER;row_cmp PLS_INTEGER;lobcnt PLS_INTEGER;cmp_ratio NUMBER;comptype_str VARCHAR2(32767);BEGINDBMS_COMPRESSION.GET_COMPRESSION_RATIO (scratchtbsname=> 'USERS' ,tabowner=> 'TEST' ,tabname=> 'PARTS' ,lobname=> 'PART_DESCRIPTION' ,partname=> NULL ,comptype=> DBMS_P_LOB_MEDIUM,blkcnt_cmp=> blkcnt_cmp,blkcnt_uncmp=> blkcnt_uncmp,row_cmp=> row_cmp,lobcnt=> lobcnt,cmp_ratio=> cmp_ratio,comptype_str=> comptype_str,subset_numrows=> DBMS_p_ratio_lob_maxrows);DBMS_OUTPUT.put_line( 'Number of blocks used by the compressed sample of the object : ' || blkcnt_cmp);DBMS_OUTPUT.put_line( 'Number of blocks used by the uncompressed sample of the object: ' || blkcnt_uncmp);DBMS_OUTPUT.put_line( 'Number of rows in a block in compressed sample of the object: ' || row_cmp);DBMS_OUTPUT.put_line( 'Number of LOBS actually sampled: ' || lobcnt);DBMS_OUTPUT.put_line ('Estimated Compression Ratio of Sample : ' || cmp_ratio);DBMS_OUTPUT.put_line( 'Compression Type : ' || comptype_str);END;/Output of Compression Advisor Estimate for Advanced LOB Compression (MEDIUM)Number of blocks used by the compressed sample of the object : 199Number of blocks used by the uncompressed sample of the object: 389Number of rows in a block in compressed sample of the object : 293Number of LOBS actually sampled : 55Estimated Compression Ratio of Sample: 1.9Compression Type: “Compress Medium”Understanding Compression Advisor ResultsThe example advisor output below, the result of running the advisor code above for Advanced Row Compression (Compress Advanced), shows the type of output that is possible with compression advisor. Number of blocks used by the compressed sample of the object: 165Number of blocks used by the uncompressed sample of the object: 629Number of rows in a block in compressed sample of the object: 599Number of rows in a block in uncompressed sample of the object: 157Estimated Compression Ratio of Sample: 3.8Compression Type: “Compress Advanced”In this example, t he “Estimated Compression Ratio of Sample” for Advanced Row Compression (Compress Advanced) determined by compression advisor, is 3.8x.This represents an approximate space reduction of 74% the table when compressed with Advanced Row Compression.Compression advisor typically provides accurate estimates, of the actual compression results obtained after implementing compression. In general, typical compression ratios for data, indexes and LOBS includes: •OLTP Table Compression and Advanced Row Compression users can typically expect compression ratios in the range of 2x to 4x•Hybrid Columnar Compression users can typically expect compression ratios in the range of 6x to 15x•Advanced Index Compression users can typically expect compression ratios in the range of 2x to 5x•Advanced LOB Compression users can typically expect compression ratios in the range of 2x to 3xNote: The compression ratio achieved, in a given environment, depends on the nature of the data being compressed.It is important to note that compression advisor builds two temporary tables (for comparison purposes) as part of the estimation process for Advanced Row Compression (Hybrid Columnar Compression uses four tables). The temporary tables are created using the prefix 'cmp3$' and/or 'cmp4$' and are dropped by the compression advisor when no longer required. Although these temporary tables are removed after11Business / Technical Brief / Getting Started with the Oracle Compression Advisor / Version 21.3 Copyright © 2023, Oracle and/or its affiliates / Publiccompression advisor completes, you will need available free space for compression advisor to build the temporary tables.For additional information about using DBMS_COMPRESSION, please see the Oracle Database documentation.Compression Advisor Best Practices•If you get this type of message when estimating Hybrid Columnar Compression:ORA-12801: error signaled in parallel query server P002ORA-64307: Exadata Hybrid Columnar Compression is notsupported for tablespaces on this storage typeSolution: Disable parallel processing for the session (setparallel_max_servers=0)•Compression adviser has the restriction that the scratch tablespace cannot be uniform•In earlier releases, Oracle did require 1M rows in a table for estimating HCC compression ratios with compression advisor – this restriction was removed in Oracle Database release 12.1.0.2 and above.•Outside compression advisor, there are no restrictions with Hybrid Columnar Compression in regards to the minimal amount of data needed (in tables/partitions) with HCC.More InformationFor more information, and examples, about compression advisor, please see this MOS note:How Does Compression Advisor Work (DOC ID: 1284972.1)Connect with usCall +1.800.ORACLE1 or visit . Outside North America, find your local office at: /contact. /oracle /oracleCopyright © 2023, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission.This device has not been authorized as required by the rules of the Federal Communications Commission. This device is not, and may not be, offered for sale or lease, or sold or leased, until authorization is obtained.Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 0120Disclaimer: If you are unsure whether your data sheet needs a disclaimer, read the revenue recognition policy. If you have further questions about your content and the disclaimer requirements, e-mail ********************.。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

ORACLE 数据库操作手册4.1中国通信集团公司安徽有限公司信息系统部2010年7月修改记录目录第一章数据库使用注意事项 (6)第一章数据库使用注意事项 (6)一、营业前台使用统一地址,后台业务严格区别业务区,不可随意访问 (6)二、不涉及当天业务的查询和统计在BCV库中操作 (6)三、前台营业时间禁止在生产环境进行大数据量的查询和统计操作 (6)四、关联表均很大的查询和统计尽量用BCV库 (6)五、按照业务规则进行DML操作,DML不要忘记执行COMMIT或ROLLBACK.. 7六、大批量更新数据的事务分次提交 (7)七、数据库DDL操作由数据库管理员根据业务规则进行 (7)八、数据库使用结束及时断开连接,但也不要频繁的连接和断开 (7)九、客户端配置与客户端第三方工具使用 (7)十、不要使用工具进行可视化数据修改操作 (7)十一、合理使用帐号,妥善保管密码 (7)十二、严禁在生产库进行业务开发、调试工作 (8)十三、单条SQL语句的长度最好不要超过1000字节 (8)十四、数据导出导入使用expdp/impdp,不要使用exp/imp (8)十五、PL/SQL程序应尽量符合第二章要求,注意事务的提交、回滚及异常情况处理 8十六、一定不能在循环体内部创建数据库的连接,包括通过JDBC连接数据库。

(8)十七、SQL语句在执行前需要对语句逻辑进行检查,避免形成隐式笛卡尔积,占用大量临时表空间和降低语句效率。

(8)第二章SQL编写注意事项 (9)一、查看表字段名或随机少量数据时,不要使用SELECT * FROM TABLENAME (9)二、SELECT 子句中避免使用* (9)三、查询总记录数时,尽量不要用COUNT(*),而要指定一个有索引的字段。

(9)四、对分区表进行查询时,尽量把分区键作为查询条件的第一个条件 (9)五、无条件删除表中数据时,用TRUNCATE代替DELETE (9)六、查询语句中尽量使用表的索引字段,避免做大表的全表扫描 (9)七、带通配符(%)的LIKE语句 (10)八、用EXISTS替代IN (10)九、用NOT EXISTS替代NOT IN (10)十、尽可能用UNION ALL替换UNION (11)十一、ORDER BY语句建议 (11)十二、避免使用NOT (11)十三、使用DECODE函数减少处理时间 (12)十四、删除重复记录 (12)十五、如果可以使用WHERE条件,尽量不要在HA VING中限制数据 (12)十六、尽量不要使数据排序 (12)十七、避免改变索引列类型 (13)十八、避免在索引列上使用计算 (13)十九、避免在索引列上使用IS NULL和IS NOT NULL (13)二十、子查询改写成表连接 (13)二十一、使用索引的第一个列 (14)二十二、减少对表的查询 (14)二十三、SQL语句中:用>=替代> (14)如果在ID列上建有索引,则语句SELECT * FROM EMPLOYEE WHERE ID >= 9 要比语句SELECT * FROM EMPLOYEE WHERE ID > 8高效。

这是由于前者DBMS将直接跳到第一个ID等于9的记录而后者将首先定位到8的记录并且向前扫描到第一个DEPT 大于9的记录。

(15)二十四、使用提示(hints) (15)二十五、大批量数据导入 (15)二十六、DBLINK使用 (15)二十七、绑定变量使用建议 (16)第三章跟踪SQL执行计划 (18)一、相关理论 (18)1、ORACLE优化器 (18)2、访问TABLE的方式 (18)3、索引访问方式 (18)二、SET TRACE跟踪SQL执行计划 (19)第一章数据库使用注意事项一、营业前台使用统一地址,后台业务严格区别业务区,不可随意访问营业网址需要通过4A系统统一使用http://10.153.176.6通过四层交换机访问,禁止访问指定的主机。

后台业务(包含后台脚本及维护人员业务操作)须严格按照业务区使用中间件及数据库实例,以避免影响数据库性能。

A1:合肥、淮北中间件:10.153.171.125 crmtux1/3(主)、10.153.171.126 crmtux1(备)10.153.171.125 bosstux1/3(主)、10.153.171.126 bosstux1(备)数据库:WCRMA1、WACCTA1、WRES1A2:阜阳、宿州、亳州、池州中间件:10.153.171.126 crmtux2/3(主)、10.153.171.125 crmtux2(备)10.153.171.126 bosstux2/3(主)、10.153.171.125 bosstux2(备)数据库:WCRMA2、WACCTA2、WRES2B1:蚌埠、马鞍山、安庆、黄山、滁州中间件:10.153.171.135 crmtux1/3(主)、10.153.171.136 crmtux1(备)10.153.171.135 bosstux1/3(主)、10.153.171.136 bosstux1(备)数据库:WCRMB1、WACCTB1、WRES1B2:芜湖、淮南、铜陵、六安、宣城中间件:10.153.171.136 crmtux2/3(主)、10.153.171.135 crmtux2(备)10.153.171.136 bosstux2/3(主)、10.153.171.135 bosstux2(备)数据库:WCRMB2、WACCTB2、WRES2二、不涉及当天业务的查询和统计在BCV库中操作BCV库每天0时同步一次(历时约1小时),数据、用户及密码与生产环境相同。

BCV 库是单节点数据库,共有WCRMABCV、WCRMBBCV、WACCTABCV、WACCTBBCV和WRESBCV等五个库。

BCV库的TBS_PERSON表空间是可写表空间。

三、前台营业时间禁止在生产环境进行大数据量的查询和统计操作前台营业时间一般为8:00-18:00(高峰时间8:30-10:30、15:00-16:30),在此期间不要在生产环境做大数据量的查询和统计,每个查询的执行时间控制在1分钟内。

四、关联表均很大的查询和统计尽量用BCV库大表关联查询操作一般会占用较大的临时表空间和较高CPU,对数据库影响较大,尤其是多个大表关联且涉及排序、分组等操作时。

五、按照业务规则进行DML操作,DML不要忘记执行COMMIT或ROLLBACK不要只执行语句,而不控制事务。

当执行一条DML语句时,数据库会分配相应锁、回滚段、REDO LOG BUFFER等资源。

语句执行后应尽快的提交或回滚释放分配的资源。

六、大批量更新数据的事务分次提交在营业忙时,大于10万的数据刷新需分次提交。

大于100万的数据刷新尽量在系统空闲时进行,并分次提交,以减少异常发生。

七、数据库DDL操作由数据库管理员根据业务规则进行DDL操作有可能涉及到存储分配、表分析、数据生命周期规划等,须数据库管理员执行,业务人员不能使用预设帐号执行DDL语句。

八、数据库使用结束及时断开连接,但也不要频繁的连接和断开数据库连接是数据库的宝贵资源,数据库支持的连接有限,不需要使用数据库时断开连接。

如果能正常退出,别用“结束任务”或kill -9。

如果正在执行SQL时发生终端异常,联系数据库管理员检查处理,以防止数据库一直占用该SQL相关资源。

九、客户端配置与客户端第三方工具使用Oracle客户端版本要求在10.2.0.4及以上,以尽量避免出现兼容性问题。

第三方工具PL/SQL Developer版本应在8.0及以上,Toad for Oracle版本应在10.0及以上,DBArtisan 版本应在8.5及以上。

十、不要使用工具进行可视化数据修改操作使用工具可视化修改数据时可能会加长数据库锁时间、增加误操作风险,因此数据修改操作须直接用SQL语句进行。

十一、合理使用帐号,妥善保管密码个人帐号能进行的操作不要使用应用帐号执行,少量数据修改的操作应通过问题知识库对个人帐号授权后进行。

帐号密码应妥善保管,不得借给他人使用,每三个月需修改一次个人帐号密码,密码应不低于8位,并含有字母、数字和特殊字符,且不能同于前五次密码。

不要非法获取未经授权的系统预设(应用)帐号密码。

不要使用未经授权的帐号登陆数据库。

帐号被锁定时联系数据库管理员解决。

十二、严禁在生产库进行业务开发、调试工作十三、单条SQL语句的长度最好不要超过1000字节1000字节对应1000个英文字符或500个中文字符,需要更长语句的操作考虑使用语句段、存储过程或临时表解决。

十四、数据导出导入使用expdp/impdp,不要使用exp/imp十五、PL/SQL程序应尽量符合第二章要求,注意事务的提交、回滚及异常情况处理十六、一定不能在循环体内部创建数据库的连接,包括通过JDBC连接数据库。

十七、SQL语句在执行前需要对语句逻辑进行检查,避免形成隐式笛卡尔积,占用大量临时表空间和降低语句效率。

第二章SQL编写注意事项一、查看表字段名或随机少量数据时,不要使用SELECT * FROM TABLENAME用DESC TABLENAME或SELECT * FROM TABLENAME WHERE 1 = 2、SELECT * FROM TABLENAME WHERE ROWNUM < 1等命令查看表结构信息,尽量不要直接执行SELECT * FROM TABLENAME,然后kill会话。

二、SELECT 子句中避免使用*在SELECT子句中列出所有的列时,使用*很方便,但是效率低。

因为ORACLE在解析过程中会查询数据字典,将*依次转换成所有的列名。

所以,直接在SELECT子句中写出想要显示的列。

三、查询总记录数时,尽量不要用COUNT(*),而要指定一个有索引的字段。

例如主键列为INDEX,使用COUNT(INDEX)能利用索引。

四、对分区表进行查询时,尽量把分区键作为查询条件的第一个条件五、无条件删除表中数据时,用TRUNCATE代替DELETE使用DELETE删除表中记录未提交时,系统会用回滚段存放被删除信息。

而TRUNCATE 命令不使用回滚段,当命令执行后,数据不能被恢复,因此很少的资源被调用,执行时间也会更短。

六、查询语句中尽量使用表的索引字段,避免做大表的全表扫描例如:WHERE子句中有联接的列,即使最后的联接值为一个静态值,也不会使用索引。

SELECT *FROM EMPLOYEEWHERE FIRST_NAME || '' || LAST_NAME = 'Beill Cliton';这条语句没有使用基于LAST_NAME创建的索引。

相关文档
最新文档