10g ASM下加控制文件 .

 

1> 检查数据库,查看控制文件存放路径
SQL> startup
ORACLE instance started.

Total System Global Area  230686720 bytes
Fixed Size      1218676 bytes
Variable Size     71305100 bytes
Database Buffers   155189248 bytes
Redo Buffers      2973696 bytes
Database mounted.
Database opened.
SQL> show parameter control;

NAME         TYPE  VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time      integer  7
control_files        string  +DATA/oradb/controlfile/backup
       .259.762002877                   //控制文件名

SQL> shutdown immediate;                    //关闭数据库
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;                       //打开数据库至nomount状态
ORACLE instance started.

Total System Global Area  230686720 bytes
Fixed Size      1218676 bytes
Variable Size     71305100 bytes
Database Buffers   155189248 bytes
Redo Buffers      2973696 bytes
SQL>
SQL> exit  
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@node1 ~]$ rman target /                    //进入RMAN

Recovery Manager: Release 10.2.0.1.0 - Production on Fri Sep 16 16:36:09 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to target database: oradb (not mounted)
RMAN> restore controlfile to '+data/oradb/controlfile/backup.259.762002875' from '+data/oradb/controlfile/backup.259.762002877'; //利用数据库当前的控制文件,创建一个新的控制文件

Starting restore at 16-SEP-11
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: copied control file copy
Finished restore at 16-SEP-11
Recovery Manager complete.
RMAN> exit
[oracle@node1 ~]$ export ORACLE_SID=+ASM
[oracle@node1 ~]$ asmcmd                              //进入ASM实例命令
ASMCMD> +data/oradb/controlfile
ASMCMD> ls -ltr                                          //查看新创建的控制文件名
Type         Redund  Striped  Time             Sys  Name
CONTROLFILE  HIGH    FINE     SEP 16 16:00:00  Y    backup.259.762002877
CONTROLFILE  HIGH    FINE     SEP 16 16:00:00  Y    backup.265.762021421
ASMCMD> exit

[oracle@node1 ~]$ export ORACLE_SID=oradb
[oracle@node1 ~]$ sqlplus / as sysdba                //进入数据库

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Sep 16 16:38:30 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> create pfile='/u01/oracle/product/10g/dbs/oradb.ora' from spfile;   //创建数据库的pfile 参数文件
File created.

SQL> shutdown immediate;                                                 //关闭数据库
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> exit

修改pfile 参数文件,添加新创建的控制文件:
[oracle@node1 dbs]$ vi /u01/oracle/product/10g/dbs/oradb.ora
将controlfile 修改为*.control_files='+DATA/oradb/controlfile/backup.259.762002877','+DATA/oradb/controlfile/backup.265.762021421'#Restore Controlfile

[oracle@node1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Sep 16 16:55:54 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> startup pfile='/u01/oracle/product/10g/dbs/oradb.ora'               //用修改后的参数文件启动数据库
ORACLE instance started.

Total System Global Area  230686720 bytes
Fixed Size      1218676 bytes
Variable Size     71305100 bytes
Database Buffers   155189248 bytes
Redo Buffers      2973696 bytes
Database mounted.
Database opened.
SQL> create spfile from pfile='/u01/oracle/product/10g/dbs/oradb.ora';     //用启动数据库的参数文件,创建spfile 参数文件(重点)

File created.
SQL> show parameter control;                                               //检查控制文件

NAME         TYPE  VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time      integer  7
control_files        string  +DATA/oradb/controlfile/backup
       .259.762002877, +DATA/oradb/co
       ntrolfile/backup.265.762021421

SQL> shutdown immediate;                         //关闭数据库 
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup                                     //启动数据库                      
ORACLE instance started.

Total System Global Area  230686720 bytes
Fixed Size      1218676 bytes
Variable Size     71305100 bytes
Database Buffers   155189248 bytes
Redo Buffers      2973696 bytes
Database mounted.
Database opened.
SQL> show parameter control;                    //验证控制文件

NAME         TYPE  VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time      integer  7
control_files        string  +DATA/oradb/controlfile/backup
       .259.762002877, +DATA/oradb/co
       ntrolfile/backup.265.762021421
SQL> shutdown immediate

完成。。。。。。。。

注:如果是RAC 环境,多个实例都要进行同样的操作后,再启动数据库。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值