首页 > 数据库 > Oracle > Oracle 控制文件的重建
-- Set #2. RESETLOGS case
--
-- 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.
-- WARNING! The current control file needs to be checked against
-- the datafiles to insure it contains the correct files. The
-- commands printed here may be missing log and/or data files.
-- Another report should be made after the database has been
-- successfully opened.
-- After mounting the created controlfile, the following SQL
-- statement will place the database in the appropriate
-- protection mode:
-- ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "XXXXX" RESETLOGS ARCHIVELOG
MAXLOGFILES 192
MAXLOGMEMBERS 3
MAXDATAFILES 1024
MAXINSTANCES 32
MAXLOGHISTORY 5840
LOGFILE
GROUP 1 '+DATA/xxxxx/onlinelog/group_1.273.926696715' SIZE 500M BLOCKSIZE 512,
GROUP 2 '+DATA/xxxxx/onlinelog/group_2.274.926696717' SIZE 500M BLOCKSIZE 512,
GROUP 5 '+DATA/xxxxx/onlinelog/group_5.277.926696723' SIZE 500M BLOCKSIZE 512,
GROUP 6 '+DATA/xxxxx/onlinelog/group_6.278.926696725' SIZE 500M BLOCKSIZE 512
-- STANDBY LOGFILE
-- GROUP 70 '+FRA/xxxxxdr/onlinelog/group_70.317.926718839' SIZE 500M BLOCKSIZE 512,
-- GROUP 73 '+FRA/xxxxxdr/onlinelog/group_73.320.926718843' SIZE 500M BLOCKSIZE 512
DATAFILE
'+DATA/xxxxx/datafile/system.289.928015019',
'+DATA/xxxxx/datafile/sysaux.285.928015017',
'+DATA/xxxxx/datafile/undotbs1.276.928015009',
'+DATA/xxxxx/datafile/users.287.928015017',
'+DATA/xxxxx/datafile/undotbs2.275.928015009',
'+DATA/xxxxx/datafile/xxxxx_data.277.928015011',
'+DATA/xxxxx/datafile/xxxxx_data.278.928015011',
'+DATA/xxxxx/datafile/xxxxx_data.279.928015011',
'+DATA/xxxxx/datafile/xxxxx_data.280.928015011',
'+DATA/xxxxx/datafile/xxxxx_index.288.928015017',
'+DATA/xxxxx/datafile/xxxxx_data.281.928015013',
'+DATA/xxxxx/datafile/xxxxx_data.282.928015013',
'+DATA/xxxxx/datafile/xxxxx_data.283.928015015',
'+DATA/xxxxx/datafile/xxxxx_data.284.928015015',
'+DATA/xxxxx/datafile/xxxxx_data.286.928015017',
'+DATA/xxxxx/datafile/xxxxx_data.290.928015019'
CHARACTER SET AL32UTF8
;
-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('SNAPSHOT CONTROLFILE NAME','TO ''+fra/xxxxx/controlfile_snapshot/snapshot_xxxxx.f''');
-- 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 '/ulic/backup/xxxxx/1_1_824297850.arc';
-- ALTER DATABASE REGISTER LOGFILE '/ulic/backup/xxxxx/1_1_895428295.arc';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Create log files for threads other than thread one.
ALTER DATABASE ADD LOGFILE THREAD 2
GROUP 3 '+DATA/xxxxxdr/onlinelog/group_3.275.926696719' SIZE 500M BLOCKSIZE 512 REUSE,
GROUP 4 '+DATA/xxxxxdr/onlinelog/group_4.276.926696721' SIZE 500M BLOCKSIZE 512 REUSE,
GROUP 7 '+DATA/xxxxxdr/onlinelog/group_7.279.926696725' SIZE 500M BLOCKSIZE 512 REUSE,
GROUP 8 '+DATA/xxxxxdr/onlinelog/group_8.280.926696727' SIZE 500M BLOCKSIZE 512 REUSE;
-- 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 '+DATA/xxxxx/tempfile/temp.265.895428301' REUSE;
-- End of tempfile additions.
5. 通过vi编辑器将以上信息编辑到文件中。
6. 在sql中通过SQL>@create_controlfile.sql来创建控制文件。
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/21374452/viewspace-2129478/ ,如需转载,请注明出处,否则将追究法律责任。