日期:2014-05-16  浏览次数:20470 次

关于Oracle归档与非归档(存档)模式命令
Sql代码
  1. sqlplus?/nolog;??
sqlplus /nolog;

?

Sql代码
  1. conn?/?as?sysdba;??
conn / as sysdba;

这样就进入了sqlplus的里面;如果你的数据库处于打开状态,那么请执行:

Sql代码
  1. shutdown?immediate;??
shutdown immediate;

?

执行完以后的步骤后,就要开始进行归档模式与非归档模式之间的转换了:

Sql代码
  1. startup?mount;??
startup mount;

?

归档->非归档

Sql代码
  1. alter?database?noarchivelog;??
alter database noarchivelog;

?

非归档->归档

Sql代码
  1. alter?database?archivelog;??
alter database archivelog;

?

检查是否成功:

Sql代码
  1. archive?log?list;??

????? 在执行startup?mount;SQL代码时可能会遇到提示:ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务。

????? 遇到上面问题请在oracle\product\10.2.0\db_1\NETWORK\ADMIN目录下找到listener.ora文件,然后修改

SID_LIST_LISTENER =
? (SID_LIST =
??? (SID_DESC =
????? (SID_NAME = PLSExtProc)
????? (ORACLE_HOME = E:\oracle10\product\10.2.0\db_1)
????? (PROGRAM = extproc)
??? )
???)

LISTENER =
? (DESCRIPTION_LIST =
??? (DESCRIPTION =
????? (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
????? (ADDRESS = (PROTOCOL = TCP)(HOST = TEST-HJ)(PORT = 1521))
??? )
? )

为:

SID_LIST_LISTENER =
? (SID_LIST =
??? (SID_DESC =
????? (SID_NAME = PLSExtProc)
????? (ORACLE_HOME = E:\oracle10\product\10.2.0\db_1)
????? (PROGRAM = extproc)
??? )
??? (SID_DESC?? =
?????? (GLOBAL_DBNAME?? =?? ORCL)
?????? (ORACLE_HOME?? =?? E:\oracle\product\10.2.0\db_1)??????
?????? (SID_NAME?? =?? ORCL)
???? )
??)

LISTENER =
? (DESCRIPTION_LIST =
??? (DESCRIPTION =
????? (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
????? (ADDRESS = (PROTOCOL = TCP)(HOST = TEST-HJ)(PORT = 1521))
??? )
? )

上述SID为orcl,如果为其他SID请填写对应SID即可,保存并覆盖原有文件,重启实例后再运行上面的命令即可。