rename备库数据文件

1、查看数据库角色
SYS@jyp>select db_unique_name,database_role from v$database;
DB_UNIQUE_NAME                 DATABASE_ROLE
------------------------------ ----------------
jyp                            PRIMARY
SYS@jzh>select db_unique_name,database_role from v$database;
DB_UNIQUE_NAME                 DATABASE_ROLE
------------------------------ ----------------
jzh                            PHYSICAL STANDBY
SYS@jyp>show parameter convert
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string      /u01/oracle/oradata/jyp, /u01/
                                                 oracle/oradata/jzh
log_file_name_convert                string      /u01/oracle/oradata/jyp, /u01/
                                                 oracle/oradata/jzh
SYS@jyp>show parameter standby
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_archive_dest                 string      ?/dbs/arch
standby_file_management              string      AUTO
SYS@jyp>select name from v$dbfile;
NAME
--------------------------------------------------------------------------------
/u01/oracle/oradata/jyp/users01.dbf
/u01/oracle/oradata/jyp/undotbs01.dbf
/u01/oracle/oradata/jyp/sysaux01.dbf
/u01/oracle/oradata/jyp/system01.dbf
/u01/oracle/oradata/jyp/jzh01.dbf
2、创建测试表空间(数据文件存放/software目录下)
SYS@jyp>create tablespace test datafile '/software/test01.dbf' size 10m;
Tablespace created.
SYS@jyp>archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/oracle/arch
Oldest online log sequence     70
Next log sequence to archive   72
Current log sequence           72
SYS@jyp>alter system switch logfile;
System altered.
SYS@jyp>archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /u01/oracle/arch
Oldest online log sequence     71
Next log sequence to archive   73
Current log sequence           73
3、查看standby alert log
Media Recovery Log /u01/oracle/arch/1_72_867602649.arc
WARNING: File being created with same name as in Primary
Existing file may be overwritten
Errors in file /u01/oracle/diag/rdbms/jzh/jzh/trace/jzh_mrp0_11208.trc:
ORA-01119: error in creating database file '/software/test01.dbf'
ORA-27054: NFS file system where the file is created or resides is not mounted with correct options
Linux-x86_64 Error: 13: Permission denied
File #6 added to control file as 'UNNAMED00006'.---6号文件在control file记录UNNAMED00006
Originally created as:
'/software/test01.dbf'
Recovery was unable to create the file as:
'/software/test01.dbf'
Errors with log /u01/oracle/arch/1_72_867602649.arc
MRP0: Background Media Recovery terminated with error 1274
Errors in file /u01/oracle/diag/rdbms/jzh/jzh/trace/jzh_mrp0_11208.trc:
ORA-01274: cannot add datafile '/software/test01.dbf' - file could not be created
Recovery interrupted!
Recovered data files to a consistent state at change 981554
MRP0: Background Media Recovery process shutdown (jzh)    ----mrp进程被shutdown
SYS@jzh>select name from v$dbfile;
NAME
--------------------------------------------------------------------------------
/u01/oracle/oradata/jzh/system01.dbf
/u01/oracle/oradata/jzh/sysaux01.dbf
/u01/oracle/oradata/jzh/undotbs01.dbf
/u01/oracle/oradata/jzh/users01.dbf
/u01/oracle/oradata/jzh/jzh01.dbf
/u01/oracle/product/11.2.0/db_1/dbs/UNNAMED00006-----数据文件被创建在$ORACLE_HOME/dbs目录下,并且命名为UNNAMED00006
6 rows selected.
4、在备库rename数据文件
SYS@jzh>alter system set standby_file_management=manual;
System altered.
SYS@jzh>alter database create datafile '/u01/oracle/product/11.2.0/db_1/dbs/UNNAMED00006' as '/u01/oracle/oradata/jzh/test01';
Database altered.
SYS@jzh>select name from v$dbfile;
NAME
--------------------------------------------------------------------------------
/u01/oracle/oradata/jzh/system01.dbf
/u01/oracle/oradata/jzh/sysaux01.dbf
/u01/oracle/oradata/jzh/undotbs01.dbf
/u01/oracle/oradata/jzh/users01.dbf
/u01/oracle/oradata/jzh/jzh01.dbf
/u01/oracle/oradata/jzh/test01
6 rows selected.
SYS@jzh>alter system set standby_file_management=auto;
System altered.
SYS@jzh>recover managed standby database disconnect from session;
Media recovery complete.
5、查看standby alert log
at Sep 12 16:37:08 2015
ALTER SYSTEM SET standby_file_management='AUTO' SCOPE=BOTH;
Sat Sep 12 16:37:25 2015
ALTER DATABASE RECOVER  managed standby database disconnect from session  
Attempt to start background Managed Standby Recovery process (jzh)
Sat Sep 12 16:37:25 2015
MRP0 started with pid=33, OS id=11451 
MRP0: Background Managed Standby Recovery process started (jzh)----MRP进程启动了。








来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/10271187/viewspace-1798261/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/10271187/viewspace-1798261/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值