Chinaunix首页 | 论坛 | 博客
  • 博客访问: 550461
  • 博文数量: 13
  • 博客积分: 1941
  • 博客等级: 上尉
  • 技术积分: 376
  • 用 户 组: 普通用户
  • 注册时间: 2011-05-05 11:21
个人简介

Where there is a will there is a way

文章分类

全部博文(13)

文章存档

2013年(4)

2012年(9)

分类: Oracle

2012-02-19 12:46:49

当数据库配置发生改变时,必须备份控制文件。例如:添加或删除日志文件、日志成员、日志组,设置归档模式,添加或删除数据文件,创建和删除表空间、表空间只读

说明存在控制文件副本
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';

阅读(1808) | 评论(1) | 转发(2) |
0

上一篇:没有了

下一篇:Clusterware详细命令

给主人留下些什么吧!~~

马夹GG2012-02-20 21:47:24

当数据库配置发生改变时,必须备份控制文件,必须常备份啊!!