Показать сообщение отдельно
  #8  
Старый 12.03.2010, 14:06
Marley Marley вне форума
Senior Member
 
Регистрация: 19.09.2009
Сообщений: 7,211
По умолчанию Восстановление управляющего файла из трассировочного файла

1)

Код:
sqlplus / as sysdba
SQL> alter database backup controlfile to trace as 'c:\controlFile.txt';
c:\controlFile.txt

Цитата:
-- The following are current System-scope REDO Log Archival related
-- parameters and can be included in the database initialization file.
--
-- LOG_ARCHIVE_DEST=''
-- LOG_ARCHIVE_DUPLEX_DEST=''
--
-- LOG_ARCHIVE_FORMAT=ARC%S_%R.%T
--
-- DB_UNIQUE_NAME="test"
--
-- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'
-- LOG_ARCHIVE_MAX_PROCESSES=2
-- STANDBY_FILE_MANAGEMENT=MANUAL
-- STANDBY_ARCHIVE_DEST=%ORACLE_HOME%\RDBMS
-- FAL_CLIENT=''
-- FAL_SERVER=''
--
-- LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE _DEST'
-- LOG_ARCHIVE_DEST_10='OPTIONAL REOPEN=300 NODELAY'
-- LOG_ARCHIVE_DEST_10='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'
-- LOG_ARCHIVE_DEST_10='REGISTER NOALTERNATE NODEPENDENCY'
-- LOG_ARCHIVE_DEST_10='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'
-- LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLIN E_LOGFILES)'
-- LOG_ARCHIVE_DEST_STATE_10=ENABLE

--
-- Below are two sets of SQL statements, each of which creates a new
-- control file and uses it to open the database. The first set opens
-- the database with the NORESETLOGS option and should be used only if
-- the current versions of all online logs are available. The second
-- set opens the database with the RESETLOGS option and should be used
-- if online logs are unavailable.
-- The appropriate set of statements can be copied from the trace into
-- a script file, edited as necessary, and executed when there is a
-- need to re-create the control file.
--
-- Set #1. NORESETLOGS 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.
-- Additional logs may be required for media recovery of offline
-- Use this only if the current versions of all online logs are
-- available.

-- 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 "TEST" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO01.LOG' SIZE 50M,
GROUP 2 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO02.LOG' SIZE 50M,
GROUP 3 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO03.LOG' SIZE 50M
-- STANDBY LOGFILE

DATAFILE
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\SYSTEM01.DB F',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\UNDOTBS01.D BF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\SYSAUX01.DB F',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\USERS01.DBF ',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\FLOW_1.DBF'
CHARACTER SET CL8MSWIN1251
;


-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('RETENTION POLICY','TO REDUNDANCY 3');
-- 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 'D:\_BACKUPS\DB_RECOVERY_FILE\TEST\ARCHIVELOG\2010 _03_12\O1_MF_1_1_%U_.ARC';
-- ALTER DATABASE REGISTER LOGFILE 'D:\_BACKUPS\DB_RECOVERY_FILE\TEST\ARCHIVELOG\2010 _03_12\O1_MF_1_1_%U_.ARC';
-- ALTER DATABASE REGISTER LOGFILE 'D:\_BACKUPS\DB_RECOVERY_FILE\TEST\ARCHIVELOG\2010 _03_12\O1_MF_1_1_%U_.ARC';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE

-- All logs need archiving and a log switch is needed.
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 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\TEMP01.DBF'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
-- 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.

-- 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 "TEST" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO01.LOG' SIZE 50M,
GROUP 2 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO02.LOG' SIZE 50M,
GROUP 3 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\REDO03.LOG' SIZE 50M
-- STANDBY LOGFILE

DATAFILE
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\SYSTEM01.DB F',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\UNDOTBS01.D BF',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\SYSAUX01.DB F',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\USERS01.DBF ',
'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\FLOW_1.DBF'
CHARACTER SET CL8MSWIN1251
;

-- Configure RMAN configuration record 1
VARIABLE RECNO NUMBER;
EXECUTE :RECNO := SYS.DBMS_BACKUP_RESTORE.SETCONFIG('RETENTION POLICY','TO REDUNDANCY 3');
-- 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 'D:\_BACKUPS\DB_RECOVERY_FILE\TEST\ARCHIVELOG\2010 _03_12\O1_MF_1_1_%U_.ARC';
-- ALTER DATABASE REGISTER LOGFILE 'D:\_BACKUPS\DB_RECOVERY_FILE\TEST\ARCHIVELOG\2010 _03_12\O1_MF_1_1_%U_.ARC';
-- ALTER DATABASE REGISTER LOGFILE 'D:\_BACKUPS\DB_RECOVERY_FILE\TEST\ARCHIVELOG\2010 _03_12\O1_MF_1_1_%U_.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

-- 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 'C:\ORACLE\PRODUCT\10.2.0\ORADATA\TEST\TEMP01.DBF'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
3) Оставить в файле c:\controlFile.txt то, что выделено черным цветом (либо блок кода из участка RESETLOGS или NORESETLOGS )

4) SQL> shutdown immediate;
SQL> startup;
SQL> @c:\controlFile.txt;
SQL> alter database open;
__________________
Телеграм чат

Последний раз редактировалось Marley; 12.12.2011 в 12:54.
Ответить с цитированием