oracle11G关闭启动归档模式并指定归档日志存储路径

一:关闭数据库归档模式

     将数据库启动到mount状态,查看当前归档模式状态,关闭归档模式

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  789172224 bytes
Fixed Size		    2257392 bytes
Variable Size		  499125776 bytes
Database Buffers	  285212672 bytes
Redo Buffers		    2576384 bytes
Database mounted.
SQL> archive log list;
Database log mode	       Archive Mode
Automatic archival	       Enabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     6
Next log sequence to archive   7
Current log sequence	       7
SQL> alter database noarchivelog;

Database altered.

SQL> archive log list;
Database log mode	       No Archive Mode
Automatic archival	       Disabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     6
Current log sequence	       7
SQL> alter database open;

Database altered.

二:启动数据库归档模式

      打开归档模式、启动数据库

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area  789172224 bytes
Fixed Size		    2257392 bytes
Variable Size		  499125776 bytes
Database Buffers	  285212672 bytes
Redo Buffers		    2576384 bytes
Database mounted.
SQL> archive log list;
Database log mode	       No Archive Mode
Automatic archival	       Disabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     6
Current log sequence	       7
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     6
Next log sequence to archive   7
Current log sequence	       7
SQL> alter database open;

Database altered.

三:归档日志存储位置挂到另外的分区,将oracle软件与归档日志分离

   在工作过程中,数据库软件产品和数据文件,控制文件,日志文件等进行分离是很有必要的,将oracle软件装到一个不用很大的分区中(一般不会有文件发生体积上的变化,个别日志除外),将数据文件、日志文件单独放置在另外的两个分区中,分区保证尽可能大,因为这部分文件都是会随之业务不断增多而增大,下面演示将归档日志重定向到指定分区:

 步骤:修改参数文件中归档日志存储路径、重启数据库实例参数生效、切换日志尝试查看修改是否生效

1.默认情况下不指定归档目录时,归档文件档联机日志切换,会在闪回区中创建归档目录,存放归档文件

--默认情况下归档日志保存在闪回区,如下参数所示
SQL> show parameter db_recovery_file_dest;

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest		     string	 /u01/app/oracle/fast_recovery_
						 area
db_recovery_file_dest_size	     big integer 4977M

--联机日志发生切换,会在闪回区创建一个与当前库名一致的目录NC65/archivelog/2019_03_08

[oracle@dbserver 2019_03_08]$ pwd
/u01/app/oracle/fast_recovery_area/NC65/archivelog/2019_03_08
[oracle@dbserver 2019_03_08]$ ls
o1_mf_1_10_g8450l7j_.arc  o1_mf_1_11_g8450ob9_.arc  o1_mf_1_12_g84535do_.arc  o1_mf_1_9_g844yqdv_.arc

2.修改归档日志查存放位置

1.创建日志存放目录(最好是单独一个分区)
[root@dbserver /]# mkdir /oralog/NC65 -p

2.授权
[root@dbserver /]# chown oracle:oinstall oralog/ -R

3.oracle11G之后归档日志存储位置可以根据如下参数指定,默认该参数为空值
SQL> show parameter log_archive_dest_1;

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1		     string

4.修改该参数文件值为归档目录位置,该参数,重启数据库才能生效
SQL> alter system set log_archive_dest_1='location=/oralog/NC65' scope=spfile;        

System altered.

SQL> show parameter log_archive_dest_1;

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1		     string

5.重启后,查询参数设置效果

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> starup;
SP2-0042: unknown command "starup" - rest of line ignored.
SQL> startup;
ORACLE instance started.

Total System Global Area  789172224 bytes
Fixed Size		    2257392 bytes
Variable Size		  499125776 bytes
Database Buffers	  285212672 bytes
Redo Buffers		    2576384 bytes
Database mounted.
Database opened.
SQL> show parameter log_archive_dest_1;

NAME				     TYPE	 VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1		     string	 location=/oralog/NC65

7.尝试切换日志,发现对应的目录中产生对应的归档

SQL> alter system switch logfile;

System altered.

SQL> /

System altered.

SQL> /

System altered.

[root@dbserver NC65]# pwd
/oralog/NC65
[root@dbserver NC65]# ls
1_13_988734334.dbf
[root@dbserver NC65]# ll
total 20644
-rw-r----- 1 oracle oinstall 21131264 Mar  8 15:35 1_13_988734334.dbf
-rw-r----- 1 oracle oinstall     2048 Mar  8 15:35 1_14_988734334.dbf
-rw-r----- 1 oracle oinstall     1024 Mar  8 15:35 1_15_988734334.dbf

 

你可能感兴趣的:(oracle成长记)