ITPub博客

rename备库数据文件

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

注册时间:2008-02-11

  • 博文量
    113
  • 访问量
    497650