#Create spfile from pfile;
#mkdir /home/oracle/archivelog
First lets check the current log mode:
SQL*Plus: Release
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault 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 165
Current log sequence 167
SQL> select name, log_mode from v$database;
NAME LOG_MODE
--------- ------------
TEST NOARCHIVELOG
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /home/oracle/product/
s/spfiletest.ora
Now lets try to set the archive log destination:
SQL> alter system set log_archive_dest_1='/home/oracle/archivelog' scope=spfile;
alter system set log_archive_dest_1='/home/oracle/archivelog' scope=spfile
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-16179: incremental changes to "log_archive_dest_1" not allowed with SPFILE
I faced the above error, thought need to enable archiving first:
SQL> alter system set log_archive_start=TRUE
2 scope=spfile;
System altered.
But I received the error again.
SQL> alter system set log_archive_dest_1='/home/oracle/archivelog' scope=spfile;
alter system set log_archive_dest_1='/home/oracle/archivelog' scope=spfile
*
ERROR at line 1:
ORA-32017: failure in updating SPFILE
ORA-16179: incremental changes to "log_archive_dest_1" not allowed with SPFILE
Checked the error description:
SQL> !oerr ora 16179
16179, 00000, "incremental changes to \"%s\" not allowed with SPFILE"
// *Cause: Incremental changes to a log_archive_dest_n parameter cannot
// be made when using an SPFILE.
// *Action: Specify either LOCATION or SERVICE plus all other attributes
// to be set in one ALTER SYSTEM/SESSION SET command.
So I did some research and found that when using spfile and trying to set a parameter like log_archive_dest_1, we need to give
complete format of the parameter like:
SQL> alter system set log_archive_dest_1='location=/home/oracle/archivelog' scope=spfile;
System altered.
(Optionally we can also give other parameters in this statement like optional, reopen etc.)
Now let shutdown the database and do a startup mount:
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 422670336 bytes
Fixed Size 1300352 bytes
Variable Size 310380672 bytes
Database Buffers 104857600 bytes
Redo Buffers 6131712 bytes
Database mounted.
Enabling archivelog mode
SQL> alter database archivelog;
Database altered.
Open the database:
SQL> alter database open;
Database altered.
Test if archivelog is set properly:
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/archivelog
Oldest online log sequence 165
Next log sequence to archive 167
Current log sequence 167
SQL> select name, log_mode from v$database;
NAME LOG_MODE
--------- ------------
TEST ARCHIVELOG
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> !ls -lrt /home/oracle/archivelog
total 44496
-rw-r----- 1 oracle oracle 45509632 2009-03-20 14:43 1_167_677948664.dbf
-rw-r----- 1 oracle oracle 1024 2009-03-20 14:43 1_168_677948664.dbf
So now we have enabled archivelog mode and have some archivelog file also!!!
沒有留言:
張貼留言