Oracle数据库的非归档模式迁移到归档模式
2014-03-20 08:03
281 查看
先观察当前的状态:
[root@o_target ~]# su - oracle
[oracle@o_target ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 19 12:38:24 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1023004672 bytes
Fixed Size 2219752 bytes
Variable Size 624951576 bytes
Database Buffers 390070272 bytes
Redo Buffers 5763072 bytes
Database mounted.
Database opened.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Current log sequence 6
SQL>
发现是没有在 Archive模式下。
进行转换,发现必须对数据库在mount状态下进行操作。
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
然后,进入mount状态,进行转换:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1023004672 bytes
Fixed Size 2219752 bytes
Variable Size 624951576 bytes
Database Buffers 390070272 bytes
Redo Buffers 5763072 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6
SQL>
发现现在缺省使用的路径为 DB_RECOVERY_FILE_DEST,此路径是和Oracle的Flash_back_recovery 路径混杂在一起的,不太妥当。
参见:
http://jinyumantang110.blog.163.com/blog/static/5457915620107994131968/ http://anuj-singh.blogspot.jp/2011/10/oracle-archive-log-on.html
其提到:never use this area for archive log file , system will hang after destination full
先观察实际路径设置:
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
尝试更改路径:
SQL> alter system set log_archive_dest = '/u01/app/arch' scope=both;
alter system set log_archive_dest = '/u01/app/arch' scope=both
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16018: cannot use LOG_ARCHIVE_DEST with LOG_ARCHIVE_DEST_n or
DB_RECOVERY_FILE_DEST
需要把 USE_DB_RECOVERY_FILE_DEST变成空值:
SQL> alter system set DB_RECOVERY_FILE_DEST='';
System altered.
SQL> alter system set log_archive_dest =
2 '/u01/app/arch' scope=both;
System altered.
SQL>
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/arch
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6
SQL>
看archive log 目录是否可以自动生成:
SQL> alter system switch logfile;
alter system switch logfile
*
ERROR at line 1:
ORA-01109: database not open
SQL>
SQL> alter database open;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> startup;
ORACLE instance started.
Total System Global Area 1023004672 bytes
Fixed Size 2219752 bytes
Variable Size 624951576 bytes
Database Buffers 390070272 bytes
Redo Buffers 5763072 bytes
Database mounted.
Database opened.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/arch
Oldest online log sequence 5
Next log sequence to archive 7
Current log sequence 7
SQL> !ls -lrt /u01/app
total 836
drwxrwx--- 5 oracle oinstall 4096 Mar 13 09:18 oraInventory
drwxr-xr-x 9 oracle oinstall 4096 Mar 13 09:24 oracle
-rw-r----- 1 oracle oinstall 840192 Mar 19 14:07 arch1_6_842088414.dbf
SQL> !ls -lrt /u01/app/arch
ls: /u01/app/arch: No such file or directory
SQL>
必须手动设置:
SQL> !ls -lrt /u01/app/arch
ls: /u01/app/arch: No such file or directory
SQL> !mkdir -p /u01/app/arch
SQL> !ls -lrt /u01/app/arch
total 0
SQL> !ls -lrt /u01/app
total 840
drwxrwx--- 5 oracle oinstall 4096 Mar 13 09:18 oraInventory
drwxr-xr-x 9 oracle oinstall 4096 Mar 13 09:24 oracle
-rw-r----- 1 oracle oinstall 840192 Mar 19 14:07 arch1_6_842088414.dbf
drwxr-xr-x 2 oracle oinstall 4096 Mar 19 14:11 arch
SQL>
[root@o_target ~]# su - oracle
[oracle@o_target ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Mar 19 12:38:24 2014
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup;
ORACLE instance started.
Total System Global Area 1023004672 bytes
Fixed Size 2219752 bytes
Variable Size 624951576 bytes
Database Buffers 390070272 bytes
Redo Buffers 5763072 bytes
Database mounted.
Database opened.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Current log sequence 6
SQL>
发现是没有在 Archive模式下。
进行转换,发现必须对数据库在mount状态下进行操作。
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
然后,进入mount状态,进行转换:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 1023004672 bytes
Fixed Size 2219752 bytes
Variable Size 624951576 bytes
Database Buffers 390070272 bytes
Redo Buffers 5763072 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6
SQL>
发现现在缺省使用的路径为 DB_RECOVERY_FILE_DEST,此路径是和Oracle的Flash_back_recovery 路径混杂在一起的,不太妥当。
参见:
http://jinyumantang110.blog.163.com/blog/static/5457915620107994131968/ http://anuj-singh.blogspot.jp/2011/10/oracle-archive-log-on.html
其提到:never use this area for archive log file , system will hang after destination full
先观察实际路径设置:
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
尝试更改路径:
SQL> alter system set log_archive_dest = '/u01/app/arch' scope=both;
alter system set log_archive_dest = '/u01/app/arch' scope=both
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-16018: cannot use LOG_ARCHIVE_DEST with LOG_ARCHIVE_DEST_n or
DB_RECOVERY_FILE_DEST
需要把 USE_DB_RECOVERY_FILE_DEST变成空值:
SQL> alter system set DB_RECOVERY_FILE_DEST='';
System altered.
SQL> alter system set log_archive_dest =
2 '/u01/app/arch' scope=both;
System altered.
SQL>
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/arch
Oldest online log sequence 4
Next log sequence to archive 6
Current log sequence 6
SQL>
看archive log 目录是否可以自动生成:
SQL> alter system switch logfile;
alter system switch logfile
*
ERROR at line 1:
ORA-01109: database not open
SQL>
SQL> alter database open;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL>
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL>
SQL> startup;
ORACLE instance started.
Total System Global Area 1023004672 bytes
Fixed Size 2219752 bytes
Variable Size 624951576 bytes
Database Buffers 390070272 bytes
Redo Buffers 5763072 bytes
Database mounted.
Database opened.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/arch
Oldest online log sequence 5
Next log sequence to archive 7
Current log sequence 7
SQL> !ls -lrt /u01/app
total 836
drwxrwx--- 5 oracle oinstall 4096 Mar 13 09:18 oraInventory
drwxr-xr-x 9 oracle oinstall 4096 Mar 13 09:24 oracle
-rw-r----- 1 oracle oinstall 840192 Mar 19 14:07 arch1_6_842088414.dbf
SQL> !ls -lrt /u01/app/arch
ls: /u01/app/arch: No such file or directory
SQL>
必须手动设置:
SQL> !ls -lrt /u01/app/arch
ls: /u01/app/arch: No such file or directory
SQL> !mkdir -p /u01/app/arch
SQL> !ls -lrt /u01/app/arch
total 0
SQL> !ls -lrt /u01/app
total 840
drwxrwx--- 5 oracle oinstall 4096 Mar 13 09:18 oraInventory
drwxr-xr-x 9 oracle oinstall 4096 Mar 13 09:24 oracle
-rw-r----- 1 oracle oinstall 840192 Mar 19 14:07 arch1_6_842088414.dbf
drwxr-xr-x 2 oracle oinstall 4096 Mar 19 14:11 arch
SQL>
相关文章推荐
- Oracle数据库归档模式的切换及其相关操作详解
- Oracle 非归档模式下 的备份 迁移
- 将Oracle数据库改为归档模式并启用RMAN备份 如下Linux环境下对Oracle单节点数据库采用文件系统情况的配置归档模式过程。首先查看数据库归档模式和磁盘使用情况,确定归档文件放到什么位置。
- RAC本地数据文件迁移至ASM的方法--非归档模式
- oracle数据库是归档模式
- 修改oracle数据库为归档模式
- 在ORACLE数据库中实现从非归档模式到归档模式的转化
- 更改oracle数据库到归档模式
- 将Oracle数据库置为归档模式
- 分享:oracle数据库归档和非归档模式如何转换
- 将oracle数据库由未归档模式更改为归档模式
- 查看oracle数据库的日志归档模式
- oracle数据库将归档模式更改为非归档模式
- oracle数据库归档模式
- oracle数据库开启或关闭归档模式
- oracle数据库启动/关闭数据库归档(ARCHIVELOG)模式
- 如何把Oracle数据库设置为归档模式?
- 查询oracle数据库是否运行在归档模式下
- 更改Oracle数据库的非归档模式
- 【转】将Oracle数据库设置为归档模式