我的oralce+linux as4
Oracle的exp工具有一个query参数可以指定一个where条件来有条件地导出记录。tables参数可以指定导出哪些表。
Windows:
exp test/test@ABC tables= table1 query=\"where number=\1179729693203\ \" file=c:\xx.dmp
linux:
exp test/test@ABC statistics=none tables=table1 query=\"where number \=\1179729693203\ \" file=/home/oracle/ora9Backup/xx.dmp
exp test/test tables=(t) file=e:\t.dmp query="""where d=to_date('200705','yyyymm')"""
exp test/test statistics=none tables=table1 query=\"where time \=to_date\(\'200705\',\'yyyymm\'\) \" file=/home/oracle/ora9Backup/xx.dmp
总结一下,好像在linux下面query语句中只要出现了符号(比如:' ( ) =)就必须在符号前面添加一个 \ 作为转义字符。
如何启用和关闭数据库的归档模式。
1.shutdown normal或shutdown immediate关闭数据库
[oracle@jumper oracle]$ sqlplus "/ as sysdba"
SQL*Plus: Release 9.2.0.4.0 - Production on Sat Oct 15 15:48:36 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
2.启动数据库到mount状态
SQL> startup mount;
ORACLE instance started.
Total System Global Area 101782828 bytes
Fixed Size 451884 bytes
Variable Size 37748736 bytes
Database Buffers 62914560 bytes
Redo Buffers 667648 bytes
Database mounted.
3.启用或停止归档模式
如果要启用归档模式,此处使用
alter database archivelog 命令。
SQL> alter database archivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /opt/oracle/oradata/conner/archive
Oldest online log sequence 148
Next log sequence to archive 151
Current log sequence 151
注意:如果 Automatic archival Disabled
则说明归档进程没有启动。使用下面的语句进行启动alter system set log_archive_start=true scope=spfile;
然后重启数据库。
如果需要停止归档模式,此处使用:
alter database noarchivelog 命令。
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 101782828 bytes
Fixed Size 451884 bytes
Variable Size 37748736 bytes
Database Buffers 62914560 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> alter database noarchivelog;
Database altered.
SQL> alter database open;
Database altered.
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Enabled
Archive destination /opt/oracle/oradata/conner/archive
Oldest online log sequence 149
Current log sequence 152
归档是需要首先考虑的。首先数据库处于非归档模式下连热备都无法进行。
打开了归档方式,比不打开归档方式 需要做多做哪些工作呢?
没什么需要多做的。就是需要有足够的归档空间。