基于用户管理的备份与恢复-备份其它文件

备份归档日志

--查看第一个归档位置过去一天以来生成的归档日志,dest_id代表归档日志存放位置,对应到v$archive_dest中1~10的destination字段值,0代表不可用

SQL> select name from v$archived_log where dest_id=1 and first_time>=sysdate-1;

NAME
------------------------------------------------------------------------------------------------------------------------
/oracle/10g/oracle/log/archive_log/archive_1_23_757801926.arclog
/oracle/10g/oracle/log/archive_log/archive_1_24_757801926.arclog

SQL> select name from v$archived_log where dest_id=10 and first_time>=sysdate-1;

NAME
------------------------------------------------------------------------------------------------------------------------
/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/2011_08_01/o1_mf_1_23_73fljh3f_.arc
/oracle/10g/oracle/product/10.2.0/db_1/flash_recovery_area/ORALIFE/archivelog/2011_08_02/o1_mf_1_24_73hwlry6_.arc

SQL> select destination from v$archive_dest;

DESTINATION
------------------------------------------------------------------------------------------------------------------------
/oracle/10g/oracle/log/archive_log
/oracle/10g/oracle/log/archive_log2







USE_DB_RECOVERY_FILE_DEST

10 rows selected.
--拷贝归档日志到指定的备份目录
cp

备份参数文件
1)如果使用文本参数文件(pfile),使用OS命令拷贝到备份目录
2)如果使用spfile,使用create pfile 进行备份
3)如果使用pfile,使用create spfile进行备份
SQL> show parameter spfile

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      /oracle/10g/oracle/product/10.
                                                 2.0/db_1/dbs/spfileoralife.ora
--创建pfile,相当于备份spfile为pfile
SQL> create pfile = '/oracle/10g/oracle/bakup/database/pfileoralife.ora'
  2  from spfile;

File created.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
--使用pfile启动数据库到nomount状态,也可以直接startup pfile='pfile全路径名'
SQL> startup nomount pfile='/oracle/10g/oracle/bakup/database/pfileoralife.ora';
ORACLE instance started.

Total System Global Area  528482304 bytes
Fixed Size                  1220360 bytes
Variable Size             146800888 bytes
Database Buffers          373293056 bytes
Redo Buffers                7168000 bytes
SQL> show parameter pfile; --当用pfile启动数据库时,spfile参数为空

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
spfile                               string
SQL> show parameter spfile;

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
spfile                               string

SQL> alter database mount;

Database altered.

SQL> alter database open;

Database altered.

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
--创建spfile到指定位置
SQL> create spfile='/oracle/10g/oracle/product/10.2.0/db_1/dbs/spfileoralife_test.ora' from
  2  pfile='/oracle/10g/oracle/bakup/database/pfileoralife.ora';

File created.

SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
--数据库启动时不能指定spfile文件位置,但可以在pfile文件中引用spfile
SQL> startup nomount spfile='/oracle/10g/oracle/product/10.2.0/db_1/dbs/spfileoralife_test.ora'
SP2-0714: invalid combination of STARTUP options
SQL> startup  spfile='/oracle/10g/oracle/product/10.2.0/db_1/dbs/spfileoralife_test.ora'
SP2-0714: invalid combination of STARTUP options
--在pfileoralife.ora中添加
*.spfile='/oracle/10g/oracle/product/10.2.0/db_1/dbs/spfileoralife_test.ora'
使用pfile启动数据库
SQL> startup nomount pfile='/oracle/10g/oracle/bakup/database/pfileoralife.ora';
ORACLE instance started.

Total System Global Area  528482304 bytes
Fixed Size                  1220360 bytes
Variable Size             146800888 bytes
Database Buffers          373293056 bytes
Redo Buffers                7168000 bytes
SQL> show parameter spfile;

NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
spfile                               string                 /oracle/10g/oracle/product/10.
                                                            2.0/db_1/dbs/spfileoralife_tes
                                                            t.ora
可以看出,已经使用了spfileoralife_test.ora。

备份口令文件
使用OS命令直接备份
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值