随笔分类 - Oracle SG
oracle student guide
摘要:1. SQL 基础进入查缺补漏阶段2. PL/SQL进入 practice 阶段3. Fundamental 1这部分还是比较重要architecture数据库启动与关闭步骤instance 与 parameter filecreate database 手动 和 dbca比较常用的数据字典cont...
阅读全文
摘要:物化视图表示在数据库的其他地方另外存放了一份as 后边的内容,如果只是普通view, 那么 rowid 是相同的, view相当于指针, 它指向基表.而物化视图的rowid 与基表是不一样的, 所以它肯定是在数据库中又保存了一份相应内容.那么, 当然你改变基表的数据, 物化视图里的值是不变的.那么物...
阅读全文
摘要:这个 stattistics 对解析 sql 时的优化器有很重要的作用, 优化器是基于 statistics 来进行优化的.desc dbms_stats 包也可以 desc (早期使用 analyze table 之类的)实验:我们创建一个新表在HR这个 schema 里, 比如 create table t ( id int, name varchar2(10));创建完以后, 我们插入 3 条记录. 并 commit;然后我们查询 DBA_TABLES 这个数据字典, 注意, 虽然我们能够查询到这个数据字典中包含 t 这个table, 但是这个table有多少行和多少block, 这些信
阅读全文
摘要:推进使用自动管理 automatic segment1 个 Blocks = 2的幂次方倍tablespace 像一块地segment 像一个房子extents 向一个装砖头的框blocks 像砖头segment 一次性最少要分配一个 extents推荐使用 UNIFORM 在创建 extent 时.grant connect, resource to mark;create table t(id int, name char(10));注意, 执行第一个命令时无法得到empty blocks 的数值, 需要执行 analyze table t compute statistics 才能得到
阅读全文
摘要:oracle 是经过多年研发的, 通用的, 质量很高, 而application 是为客户定制的, 一次性的, 质量可能会出问题.数据库的 move 的含义, 是将老表copy到新的表, 然后将新表命名为老表的名字.为什么要move呢, 可能是表的物理结构有问题, 有很多碎片化. 或者是 PCTFR...
阅读全文
摘要:90% 是Heap tableCluster 集群表,index-organized table: 就是把索引和表 和二为一了.partitioned table:表非常大, 逻辑上是一个大表, 每个partition 又是一个小表rows read in groups : 是不是一起读, 可以考虑 claster 表unclustered: 一个Block 里只存储一个表的数据可以看到图, 集群表的多个表数据是放在一个block上的.首先创建一个集群, 创建cluster时可以指定存储信息, 注意在这个集群中的表就不要再指定存储信息了.注意下边的 cluster mycluster(dept
阅读全文
摘要:这一章还是概述性的说明优化器现在都是在用 Cost-based 这种调优器注意这本书的作者是个大牛, 他就是说 DBA OVER 那个人, Jonathan Lewishint 是人告诉SQL语句使用什么优化, 优先级从下到上. statement->session->instanceALL_ROWS: 缺省值, 完成所有的row, 用于批处理比较好(9i的缺省值是 choose)FIRST_ROWS_n : 为了返回头n条记录最好的办法, 这种用于 interface, 当人在看的时候可以先返回100行, 其余的oracle慢慢查FIRST_ROWS: 向后兼容使用, 10g 1
阅读全文
摘要:Redo Log Buffer ContentThe Oracle server processes copy redo entries from the user’s memory space to the redo log buffer for each DML or DDL statement.The redo entries contain the information necessary to reconstruct or redo changes made to the database by INSERT, UPDATE, DELETE, CREATE, ALTER or DR
阅读全文
摘要:Buffer Cache 特性The buffer cache holds copies of the data blocks from the data files. Because the buffer cache is a part of the SGA, these blocks can be shared by all users. The server processes read data from the data files into buffer cache.(是server process 将数据从硬盘读取到内存的) To improve performance, the
阅读全文
摘要:The Export utility can provide a logical backup of:Database objectsA tablespaceAn entire databaseThe Import utility is used to read a valid Export file for moving data into a database. Redo log history cannot be applied to objects that are imported from an export file, therefore data loss may occur,
阅读全文
摘要:CROSSCHECK: 确认 rman repository 与 实际的备份集 是否同步.你可以先使用 LIST 命令查看你之前做的备份的情况, 然后使用 CROSSCHECK 命令来确认这些文件还存在没有. 如果RMAN没有找到这些文件, 它将更新 respository 显示 expired超期. 你可以用过 LIST EXPIRED 查看那些文件超期了, 将超期的文件删除.CROSSCHECK BACKUP; -- 用于确认备份集, backup pieces, and proxy copies, 默认的是会确认整个数据库CROSSCHECK COPY; -- cross check d
阅读全文
摘要:share pool : (组成)library cache: stores shared sql and pl/sql code (包含 statement text, parsed code, execution plan)data dictionary cache : keeps information about dictionary objects. (包含 definitions for tables, columns, and privileges from the data dictionary tables)调优 share pool 考虑的内容:A cache miss o
阅读全文
摘要:1. 尽量读内存中的数据2. 尽量减少IO矛盾, 即多个任务同时读写一块磁盘表和索引要尽量分开在不同磁盘, 因为表和它的索引是同时读取的, 所以分磁盘后, 对性能会提高.物理磁盘的调优相关redo log file 放在最快的磁盘上, data 放在容量大, 速度慢一点也没关系表和索引是同时读取的,所以表和索引分开磁盘比较好FTS 就是全表扫描的意思并不是所有时刻都要避免全表扫描,通常来说需要避免不必要的全表扫描一次性读取多少块这个参数的设置(DB_FILE_MULTIBLOCK_READ_COUNT),是需要和操作系统配合的,必须在操作系统准许的范围内是server process 去读这个
阅读全文
摘要:永无止境的调优service level agreements: 是一个量化的调优的指标.performance 只要满足业务OK就可以了, 没必要调的很多, 因为有得必有失, 一方面调的特别优化, 可能导致另一方面出问题主要还是关注SQL调优把(Troubleshooting Oracle performance 这本书主要是针对SQL的调优)调优是告诉你怎么样使用ORACLE没有1本书能大而全的论述性能调优database administrators 和 system administrators 都需要调优第1部分: 开发人员, 测试人员和DBA一起调优(这部分内容比较重要, 主要针对
阅读全文
摘要:statspack是一个很重要的工具, 这是我们重点要知道的在这章每天一上班就要看一下 alert log 文件, 可以通过/ORA找, 这是vi的知识,所有的ORACLE错误都是以ORA开头的日志文件有的时候需要将里边内容拷贝走,清空。 cat /dev/null > alert_pitts.log (直接删除也可以, 删除后oracle会自动产生)每天确认 Alert log file 是很重要的. 确认的内容:1. 带 ORA 开头的错误的内容2. 那些可以影响到 database structure and parameters and statements的操作, 例如 cre
阅读全文
摘要:- RMAN 全部是自动的 Using RMAN you can perform recovery at the following levels: > database > Tablespace > datafile
阅读全文
摘要:oracle 主要的备份工具 RMAN其中,open database backup, 不需要把数据库设置成backup状态,RMAN reads a block until a consistent read is obtained.看来备份比较重要的三种文件分别是, data file, control file, archivelog file.Types of Recovery Manager BackupsThe entire database, every datafile in a tablespace, or a single datafile.The control file
阅读全文
摘要:complete recovery: 完全恢复, 数据几乎没有丢失.不完全恢复: 恢复, 只能恢复到没有发生问题之前的某个时间点的数据.( 注意是某个时间点 )先将cope过来的内容copy 回去, 然后根据 redo log 和 archive log 日志进行 redo data.1. 还原数据库到 backup 时间点( 全备 )2. Changes from the archived redo log files and online redo log files are applied as necessary. undo blocks are generated at this t
阅读全文
摘要:手动备份 (冷备, 热备 都支持, 跟 RMAN 没关系)后边两个是 一致性备份 和 不一致性备份全备:可以在数据库打开或关闭时. (备份 control file 和 data file) 如果是关闭时候的备份, 就是一致性备份, In such a backup, all the database file headers are consistent whith the control file, and when restored completely, the database can be opened without any recovery. When the database
阅读全文