Wednesday 30 August 2017

Enabling ARCHIVELOG mode in Oracle step by step

-----------Put 12c Database in archive log Mode-----------


[oracle@exacell01 ~]$ export ORACLE_SID=CDB3
[oracle@exacell01 ~]$ export ORACLE_HOME=/u01/app/oracle/product/db_1

-----check status of archive log----------


[oracle@exacell01 ~]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Sun Feb 7 13:09:51 2016

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

Enter user-name: / as sysdba

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> archive log list
Database log mode       No Archive Mode
Automatic archival       Disabled
Archive destination       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     20
Current log sequence       22
SQL>
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
[oracle@exacell01 ~]$ id
uid=1002(oracle) gid=508(oinstall) groups=503(dba),504(oper),505(asmdba),506(asmoper),507(asmadmin),508(oinstall)

-----check available space on server

[oracle@exacell01 ~]$ mkdir -p /ora/cdb3/arch
[oracle@exacell01 ~]$ chmod 640 /u01/cdb3/arch
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@exacell01 ~]$ ls -lt
/home/oracle
[oracle@exacell01 ~]$ cd $ORACLDE_HOME$ORACLE_HOME/dbs
[oracle@exacell01 dbs]$ ls -ltr
total 31372
-rw-r--r-- 1 oracle oinstall     2992 Feb  3  2012 init.ora
-rw-r--r-- 1 oracle oinstall      548 Feb  5 20:13 initcdb1.ora
-rw-r----- 1 oracle oinstall       24 Feb  5 20:17 lkCDB
-rw-rw---- 1 oracle oinstall     1544 Feb  5 20:18 hc_cdb1.dat
-rw-r----- 1 oracle oinstall     2560 Feb  5 23:53 spfilecdb1.ora
-rw-r--r-- 1 oracle oinstall      551 Feb  6 12:23 initcdb2.ora
-rw-r--r-- 1 oracle oinstall     1328 Feb  6 12:39 cont.ctl
-rw-r----- 1 oracle oinstall       24 Feb  6 12:40 lkCDB2
drwxr-xr-x 3 oracle oinstall     4096 Feb  6 12:41 u01
-rw-rw---- 1 oracle oinstall     1544 Feb  6 13:01 hc_cdb2.dat
-rw-r--r-- 1 oracle oinstall 14045086 Feb  6 15:06 create_dd.log
-rw-r----- 1 oracle oinstall 17973248 Feb  6 17:25 snapcf_CDB2.f
-rw-rw---- 1 oracle oinstall     1544 Feb  7 10:58 hc_CDB2.dat
-rw-r--r-- 1 oracle oinstall     1328 Feb  7 11:34 cont1.ctl
-rw-r--r-- 1 oracle oinstall      551 Feb  7 11:35 initcdb3.ora
-rw-r----- 1 oracle oinstall       24 Feb  7 11:36 lkCDB3
-rw-rw---- 1 oracle oinstall     1544 Feb  7 11:43 hc_CDB3.dat
[oracle@exacell01 dbs]$ sqlplus

SQL*Plus: Release 12.1.0.2.0 Production on Sun Feb 7 13:18:46 2016

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

Enter user-name: / as sysdba

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options


SQL> startup
ORACLE instance started.

Total System Global Area  629145600 bytes
Fixed Size    2927528 bytes
Variable Size  184550488 bytes
Database Buffers  436207616 bytes
Redo Buffers    5459968 bytes
Database mounted.
Database opened.
SQL>
SQL> alter system set log-archive _archive_dest_1='location=u01/cdb3/arch' scope=spfile;

System altered.

SQL> alter system set log- _archive_dest_state_1='ENABLE' scope=spfile;

System altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup pfile=initcdb3.ora
ORACLE instance started.

Total System Global Area  629145600 bytes
Fixed Size    2927528 bytes
Variable Size  184550488 bytes
Database Buffers  436207616 bytes
Redo Buffers    5459968 bytes
Database mounted.
Database opened.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> str   startup mount pfile=initcdb3.ora
ORACLE instance started.

Total System Global Area  629145600 bytes
Fixed Size    2927528 bytes
Variable Size  184550488 bytes
Database Buffers  436207616 bytes
Redo Buffers    5459968 bytes
Database mounted.
SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> alter system archive log current;

System altered.

SQL> alter system archive log current
  2  ;

System altered.

SQL> !ls -ltr /u01/archiv      db  cdb3/arch
total 28872
-rwxr-xr-x 1 oracle oinstall     1024 Feb  7 13:47 o1_mf_1_23_ccfyjyop_.arc
-rwxr-xr-x 1 oracle oinstall 29522432 Feb  7 13:47 o1_mf_1_22_ccfyjh1w_.arc

SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
[oracle@exacell01 dbs]$

No comments:

Post a Comment