当数据库配置发生改变时,必须备份控制文件。例如:添加或删除日志文件、日志成员、日志组,设置归档模式,添加或删除数据文件,创建和删除表空间、表空间只读
说明存在控制文件副本
SQL> alter database backup controlfile to '/recovery/backs/backs/noyizhi/control02.ctl';
alter database backup controlfile to '/recovery/backs/backs/noyizhi/control02.ctl'
*
ERROR at line 1:
ORA-01580: error creating control backup file
/recovery/backs/backs/noyizhi/control02.ctl
ORA-27038: created file already exists
Additional information: 1
覆盖方式备份controlfile
SQL> alter database backup controlfile to '/recovery/backs/backs/noyizhi/control02.ctl' reuse;
备份controlfile到跟踪文件
SQL> alter database backup controlfile to trace;
Database altered.
查看位置
SQL> show parameter user_dump_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
user_dump_dest string /u01/app/oracle/admin/ocp/udump
通过SQL> select username,paddr from v$session;和SQL> select spid,addr from v$process;中的USERNAME、PADDR、SPID、ADDR四个字段定位
SQL> select a.spid from v$process a,v$session b where a.addr=b.paddr and b.username='SYS';
SPID
------------
5809
[oracle@sc udump]$ cat ocp_ora_5809.trc
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "OCP" RESETLOGS FORCE LOGGING ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/app/oracle/oradata/ocp/redo01.log' SIZE 50M,
GROUP 2 '/u01/app/oracle/oradata/ocp/redo02.log' SIZE 50M,
GROUP 3 '/u01/app/oracle/oradata/ocp/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/u01/app/oracle/oradata/ocp/system01.dbf',
'/u01/app/oracle/oradata/ocp/undotbs01.dbf',
'/u01/app/oracle/oradata/ocp/sysaux01.dbf',
'/u01/app/oracle/oradata/ocp/users01.dbf',
'/u01/app/oracle/oradata/ocp/example01.dbf',
'/u01/app/oracle/oradata/perstat.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 '/recovery/arch/arch_1_1_562360180.log';
-- ALTER DATABASE REGISTER LOGFILE '/recovery/arch/arch_1_1_767120319.log';
-- 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.
;
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Files in normal offline tablespaces are now named.
ALTER DATABASE RENAME FILE 'MISSING00007'
TO '/u01/app/oracle/oradata/ocp/testo.dbf';
阅读(1283) | 评论(0) | 转发(0) |