Oracle 控制文件 说明(四)

2014-11-24 18:01:14 · 作者: · 浏览: 2
app/oracle/oradata/dave/undotbs01.dbf',


'/u01/app/oracle/oradata/dave/sysaux01.dbf',


'/u01/app/oracle/oradata/dave/users01.dbf'


CHARACTER SET ZHS16GBK


;


--以上是创建控制文件的语法


-- Commands to re-create incarnation table


-- Below log names MUST be changed to existing filenames on


-- disk. Any one log file from each branch can be used to


-- re-create incarnation records.


-- ALTER DATABASE REGISTER LOGFILE '/u01/archivelog/1_1_746031707.dbf';


-- Recovery is required if any of the datafiles are restoredbackups,


-- or if the last shutdown was not normal orimmediate.


RECOVER DATABASE


-- All logs need archiving and a log switch isneeded.


ALTER SYSTEM ARCHIVE LOG ALL;


-- Database can now be opened normally.


ALTER DATABASE OPEN;


-- Commands to add tempfiles to temporary tablespaces.


-- Online tempfiles have complete space information.


-- Other tempfiles may require adjustment.


ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/dave/temp01.dbf'


SIZE 32505856 REUSE AUTOEXTEND OFF;


--这里是要注意的地方,重建控制文件的时候,不能写上临时表空间,等控制文件创建完毕之后,在手工的执行SQL加上临时表空间。


-- End of tempfile additions.


--


-- Set#2. RESETLOGS case


--第二种情况,使用resetlogs 的说明


--


-- The following commands will create a new control file and use it


-- to open the database.


-- Data used by Recovery Manager will be lost.


-- The contents of online logs will be lost and all backups will


-- be invalidated. Use this only if online logs are damaged.


-- After mounting the created controlfile, the following SQL


-- statement will place the database in the appropriate


-- protection mode:


-- ALTER DATABASE SET STANDBYDATABASE TO MAXIMIZE PERFORMANCE


STARTUP NOMOUNT


CREATE CONTROLFILE REUSE DATABASE "DAVE" RESETLOGS ARCHIVELOG


MAXLOGFILES 16


MAXLOGMEMBERS 2


MAXDATAFILES 30


MAXINSTANCES 1


MAXLOGHISTORY 292


LOGFILE


GROUP 1'/u01/app/oracle/oradata/dave/redo01.log' SIZE 50M,


GROUP 2'/u01/app/oracle/oradata/dave/redo02.log' SIZE 50M,


GROUP 3 '/u01/app/oracle/oradata/dave/redo03.log' SIZE 50M


-- STANDBY LOGFILE


DATAFILE


'/u01/app/oracle/oradata/dave/system01.dbf',


'/u01/app/oracle/oradata/dave/undotbs01.dbf',


'/u01/app/oracle/oradata/dave/sysaux01.dbf',


'/u01/app/oracle/oradata/dave/users01.dbf'


CHARACTER SET ZHS16GBK


;


-- Commands to re-create incarnation table


-- Below log names MUST be changed to existing filenames on


-- disk. Any one log file from each branch can be used to


-- re-create incarnation records.


-- ALTER DATABASE REGISTER LOGFILE '/u01/archivelog/1_1_746031707.dbf';


-- Recovery is required if any of the datafilesare restored backups,


-- or if the last shutdown was not normal or immediate.


RECOVER DATABASE USING BACKUP CONTROLFILE


-- Database can now be opened zeroing the online logs.


ALTER DATABASE OPEN RESETLOGS;


-- Commands to add tempfiles to temporary tablespaces.


-- Online tempfiles have complete space information.


-- Other tempfiles may require adjustment.


ALTER TABLESPACE TEMP ADD TEMPFILE'/u01/app/oracle/oradata/dave/temp01.dbf'


SIZE 32505856 REUSE AUTOEXTEND OFF;


-- End of tempfile additions.


--



注意里面的几个参数:


(1MAXDATAFILES


The MAXDATAFILES optionof CREATE DATABASE determines the number of data files a database can have.With Oracle Real Application Clusters, databases tend to have more data filesand log files than an exclusive mounted database.


(2) MAXINSTANCES


The MAXINSTANCES optionof CREATE DATABASE limits the number of instances that can access a databaseconcurrently. The default value for this option underz/OS is 15. Set MAXINSTANCES to a value g