时间:2021-07-01 10:21:17 帮助过:29人阅读
测试使用alter database backup controlfile to trace命令备份oracle10g控制文件以及在丢失控制文件的情况下恢复控制文件之--备份
测试使用alter database backup controlfile to trace命令备份Oracle10g控制文件
以及在丢失控制文件的情况下恢复控制文件之--备份控制文件
查看alter database backup controlfile to trace的默认路径
SQL> show parameter user_dump_dest;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
user_dump_dest string /data/oracle/admin/asp/udump
这是下面的备份控制文件语句默认备份的位置.
部分标记了对应的建立控制文件的语句:
注意这里面记录了两种情况:
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
;
-- 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 '/data/archive/redhat10g_1_562360180_1.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/data/archive/redhat10g_1_817828234_1.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE
-- Set Database Guard and/or Supplemental Logging
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
-- 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 '/data/oracle/oradata/asp/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 "ASP" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/data/oracle/oradata/asp/redo01.log' SIZE 50M,
GROUP 2 '/data/oracle/oradata/asp/redo02.log' SIZE 50M,
GROUP 3 '/data/oracle/oradata/asp/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/data/oracle/oradata/asp/system01.dbf',
'/data/oracle/oradata/asp/undotbs01.dbf',
'/data/oracle/oradata/asp/sysaux01.dbf',
'/data/oracle/oradata/asp/users01.dbf',
'/data/oracle/oradata/asp/dgbc01.dbf',
'/data/oracle/oradata/asp/dgbc02.dbf',
'/data/oracle/oradata/asp/dgbc03.dbf',
'/data/oracle/oradata/asp/dgbc04.dbf',
'/data/oracle/oradata/asp/dgbc05.dbf',
'/data/oracle/oradata/asp/dgbc06.dbf'
CHARACTER SET WE8ISO8859P1
;
-- 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 '/data/archive/redhat10g_1_562360180_1.dbf';
-- ALTER DATABASE REGISTER LOGFILE '/data/archive/redhat10g_1_817828234_1.dbf';
-- 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
-- Set Database Guard and/or Supplemental Logging
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
-- 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/oracle/oradata/asp/temp01.dbf'
SIZE 20971520 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
--
下一篇 从这个备份的文本文件来手工恢复控制文件。