码迷,mamicode.com
首页 > 数据库 > 详细

如何解决Oracle数据库的非归档模式迁移到归档模式中存在的问题

时间:2014-12-20 10:29:38      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:linux   数据库   oracle   11g   实例   

今天在做oracle归档测试的时候发现了几个问题,在这里记录下来希望能得到大家的纰漏和帮助

[oracle@localhost ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 19 17:34:42 2014

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
由于对oracle数据库不太熟悉,在执行了下面的命令的时候感到好奇怪:
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-01126: database must be mounted in this instance and not open in any instance
这句话意思是说,要想进行配置归档,必须属于一个数据库实例中,这个在RAC中会出现这个问题可以参见:
<a target=_blank href="http://shuimomo.blog.51cto.com/1141396/933434">点击打开链接</a>
</pre><pre code_snippet_id="557252" snippet_file_name="blog_20141220_7_6900758" name="code" class="sql" style="font-size:18px;">但是我发现我是测试在VM的环境下,不存在这种RAC情况:我试了两种情况第一种可以。只有mount的情况才可以操作
<table border="1" width="500" cellspacing="1" cellpadding="1"><tbody><tr><td>SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.


Total System Global Area  417546240 bytes
Fixed Size                  2213936 bytes
Variable Size             314574800 bytes
Database Buffers           96468992 bytes
Redo Buffers                4288512 bytes
Database mounted.
SQL> alter database archivelog;


Database altered.</td></tr><tr><td>SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.


Total System Global Area  417546240 bytes
Fixed Size                  2213936 bytes
Variable Size             314574800 bytes
Database Buffers           96468992 bytes
Redo Buffers                4288512 bytes
Database mounted.
Database opened.
SQL> alter database archivelog;
alter database archivelog
*
ERROR at line 1:
ORA-01126: database must be mounted in this instance and not open in any instanc                                          e</td></tr></tbody></table>
SQL> show parameter db_recovery_file_dest;

NAME                                 TYPE
------------------------------------ --------------------------------
VALUE
------------------------------
db_recovery_file_dest                string
/u01/app/oracle/flash_recovery
_area
db_recovery_file_dest_size           big integer
3882M
<span style="color: rgb(57, 57, 57); font-family: verdana, 'ms song', Arial, Helvetica, sans-serif; font-size: 14px; line-height: 21px; background-color: rgb(250, 247, 239);">发现现在缺省使用的路径为 DB_RECOVERY_FILE_DEST,此路径是和Oracle的Flash_back_recovery 路径混杂在一起的,不太妥当。</span>
<span style="font-family:verdana, ms song, Arial, Helvetica, sans-serif;color:#393939;"><span style="font-size: 14px; line-height: 21px;">所以要进行修改:</span></span>
SQL> alter system set log_archive_dest = '/u01/app/oracle/arch' scope = spfile;

System altered.

SQL> !ls -lrt  /u01/app/oracle
total 48
drwxr-xr-x 2 oracle oinstall 4096 Dec 15 21:25 checkpoints
drwxr-x--- 5 oracle oinstall 4096 Dec 15 22:03 cfgtoollogs
drwxr-x--- 3 oracle oinstall 4096 Dec 15 22:04 oradata
drwxr-x--- 3 oracle oinstall 4096 Dec 15 22:04 admin
drwxrwxr-x 4 oracle oinstall 4096 Dec 15 22:04 diag
drwxr-x--- 4 oracle oinstall 4096 Dec 15 22:06 flash_recovery_area

通过上面的查看你会发现数据库并没有为其创建一个arch目录,在建立日志文件的时候恰恰相反,假如当前目录下有你想创建的
文件你必须要先删除了再创建该文件。这个要注意一下。
</pre><pre code_snippet_id="557252" snippet_file_name="blog_20141220_16_9214578" name="code" class="sql" style="font-size:18px;">SQL> !pwd
/home/oracle

SQL> !mkdir /u01/app/oracle/arch

SQL> !ls -lrt /u01/app/oracle
total 52
drwxr-xr-x 2 oracle oinstall 4096 Dec 15 21:25 checkpoints
drwxr-x--- 5 oracle oinstall 4096 Dec 15 22:03 cfgtoollogs
drwxr-x--- 3 oracle oinstall 4096 Dec 15 22:04 oradata
drwxr-x--- 3 oracle oinstall 4096 Dec 15 22:04 admin
drwxrwxr-x 4 oracle oinstall 4096 Dec 15 22:04 diag
drwxr-x--- 4 oracle oinstall 4096 Dec 15 22:06 flash_recovery_area
drwxr-xr-x 2 oracle oinstall 4096 Dec 19 17:41 arch

SQL>





如何解决Oracle数据库的非归档模式迁移到归档模式中存在的问题

标签:linux   数据库   oracle   11g   实例   

原文地址:http://blog.csdn.net/u011218159/article/details/42040807

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!