parknkjun

Focus on Oralce Focus on Mysql 版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!

  • 博客访问: 462273
  • 博文数量: 117
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-11 15:59
  • 认证徽章:
个人简介

姓名:江政恒 网络ID:parknkjun Oracle 10g OCM, Oracle 11g,12c OCP, OCMU成员, Oracle Young Expert 邮箱:parknkjun@163.com 电话:15502113137 QQ群:136904065

ITPUB论坛APP

ITPUB论坛APP



APP发帖 享双倍积分

文章分类
文章存档

2017年(4)

2016年(24)

2015年(61)

2014年(27)

2013年(1)

我的朋友
微信关注

IT168企业级官微



微信号:IT168qiye



系统架构师大会



微信号:SACC2013

订阅
热词专题
rename备库数据文件 2015-09-13 00:48:14

分类: Oracle

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进程启动了。








阅读(1116) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~
评论热议
请登录后评论。

登录 注册