SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/u01/oradata/denver/system01.dbf
/u01/oradata/denver/undotbs01.dbf
/u01/oradata/denver/cwmlite01.dbf
/u01/oradata/denver/drsys01.dbf
/u01/oradata/denver/example01.dbf
/u01/oradata/denver/indx01.dbf
/u01/oradata/denver/odm01.dbf
/u01/oradata/denver/tools01.dbf
/u01/oradata/denver/users01.dbf
/u01/oradata/denver/xdb01.dbf
|
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/u01/oradata/denver/control01.ctl
/u01/oradata/denver/control02.ctl
/u01/oradata/denver/control03.ctl
|
SQL> ! ls /u01/oradata/denver
archive control03.ctl example01.dbf redo01.log system01.dbf undotbs01.dbf
control01.ctl cwmlite01.dbf indx01.dbf redo02.log temp01.dbf users01.dbf
control02.ctl drsys01.dbf odm01.dbf redo03.log tools01.dbf xdb01.dbf
|
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string ?/dbs/[email protected]
SQL> ! ls $ORACLE_HOME/dbs
initdenver.ora init.ora lkDENVER spfiledenver.ora
initdw.ora lkAAA orapwdenver spfiledenver.ora.bak
|
/u01/oradata/denver/*dbf(
数据文件
)
/u01/oradata/denver/*.ctl(
控制文件
)
$ORACLE_HOME/dbs/spfiledenver.ora(
参数文件
)
$ORACLE_HOME/dbs/orapwdenver(
密
码
文件
)
|
SQL> archive log list
Database log mode Archive Mode
Automatic archival
Enabled
Archive destination
/u01/oradata/denver/archive
|
SQL> alter database begin backup;
Database altered.
SQL>! cp /u01/oradata/denver/*.dbf /u01/backup/
SQL>alter database backup controlfile to '/u01/backup/
backup
.ctl
'
SQL>! cp $ORACLE_HOME/dbs/spfiledenver.ora /u01/backup/
SQL>! cp $ORACLE_HOME/dbs/orapwdenver /u01/backup/
SQL>! alter database end backup;
SQL>alter system archive log current;
|
SQL> select file_name from dba_data_files where tablespace_name='TEST1';
FILE_NAME
--------------------------------------------------------------------------------
/u01/test1.dbf
SQL> alter tablespace test1 offline;
Tablespace altered.
SQL> ! cp /u01/test1.dbf /u01/backup
SQL> alter tablespace test1 online;
Tablespace altered.
|
SQL> alter tablespace test1 begin backup;
Tablespace altered.
SQL> ! cp /u01/test1.dbf /u01/backup/
SQL> alter tablespace test1 end backup;
Tablespace altered.
|
SQL> alter database begin backup;
Database altered.
SQL>alter database backup controlfile to '/u01/backup/
backup
.ctl'
#
如果第二次使用这个命令,在最后加参数
reuse(
覆盖前一个
)
SQL>alter database backup controlfile to '/u01/backup/
backup
.ctl'
reuse
;
SQL>! alter database end backup;
|
#
参数文件
SQL>create pfile from spfile
SQL>! cp $ORACLE_HOME/dbs/spfiledenver.ora /u01/backup/
#
口今文件
SQL>! cp $ORACLE_HOME/dbs/orapwdenver /u01/backup/
|
#
备份过去一天的归档日志
SQL> select name from v$archived_log where dest_id=1 and first_time>=sysdate-1;
NAME
--------------------------------------------------------------------------------
/u01/oradata/denver/archive/1_12.dbf
/u01/oradata/denver/archive/1_13.dbf
/u01/oradata/denver/archive/1_14.dbf
SQL>! cp
/u01/oradata/denver/archive/1_12.dbf
/u01/backup/
SQL>! cp
/u01/oradata/denver/archive/1_1
3
.dbf
/u01/backup/
SQL>! cp
/u01/oradata/denver/archive/1_1
4
.dbf
/u01/backup/
|