oracle 恢复参数文件,Oracle参数文件(spfile)恢复

Oracle参数文件(spfile)恢复

参数文件的修改不会在重做日志里做记录,所以,不管是全部还是部分丢失,仅做restore操作,不存在recover动作

参数文件的丢失分为两类

1、参数文件丢失,实例crash

2、参数文件丢失,实例正常运行

1、模拟参数文件丢失且实例crash了

SQL> startup;

ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file ‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/inittrsen.ora’

SQL> ! ps -ef | grep pmon_t=========》》实例关闭了

oracle 7528 7513 0 15:10 pts/1 00:00:00 /bin/bash -c ps -ef | grep pmon_t

oracle 7530 7528 0 15:10 pts/1 00:00:00 grep pmon_t

利用rman启动到nomount阶段,一般如果没有参数文件是无法启动的,rman是利用_dummy_instance隐藏参数来控制

因为restore参数文件需要在实例启动下才能做restore,现在rman通过隐藏参数方式启动一个实例名相同但db_name不同的实例,从而来避免无法获取备份集里的参数文件的信息

RMAN> startup nomount;

startup failed: ORA-01078: failure in processing system parameters

LRM-00109: could not open parameter file ‘/u01/app/oracle/product/11.2.0/dbhome_1/dbs/inittrsen.ora’

starting Oracle instance without parameter file for retrieval of spfile

Oracle instance started

Total System Global Area 1068937216 bytes

Fixed Size 2260088 bytes

Variable Size 398459784 bytes

Database Buffers 654311424 bytes

Redo Buffers 13905920 bytes

在alert日志里可以看到rman默认启动一个db_name为DUMMY的实例,其启动的sid名字还是trsen

System parameters with non-default values:

sga_target = 1G

compatible = “11.2.0.4.0”

_dummy_instance = TRUE

remote_login_passwordfile= “EXCLUSIVE”

db_name = “DUMMY”

Mon Dec 21 15:18:18 2015

PMON started with pid=2, OS id=8128

Mon Dec 21 15:18:18 2015

PSP0 started with pid=3, OS id=8130

Mon Dec 21 15:18:19 2015

SQL> !ps -ef | grep pmon_t

oracle 8128 1 0 15:18 ? 00:00:00 ora_pmon_trsen============》》》》

oracle 9334 9328 0 15:43 pts/1 00:00:00 /bin/bash -c ps -ef | grep pmon_t

oracle 9336 9334 0 15:43 pts/1 00:00:00 grep pmon_t

利用手工的方式从备份的参数文件里恢复spfile

RMAN> restore spfile from ‘/oradata/bk1/c-3731845208-20151218-15’;

Starting restore at 21-DEC-15

using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /oradata/bk1/c-3731845208-20151218-15

channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete

Finished restore at 21-DEC-1

启动数据库实例

SQL> shutdown abort;

ORACLE instance shut down.

SQL> startup;

ORACLE instance started.

Total System Global Area 6.0663E+10 bytes

Fixed Size 2268032 bytes

Variable Size 5637145728 bytes

Database Buffers 5.4895E+10 bytes

Redo Buffers 128344064 bytes

Database mounted.

Database opened.

SQL> show parameter db_name;

NAME TYPE VALUE

———————————— ———– ——————————

db_name string trsen

若有恢复目录,可以利用恢复目录去做

[oracle@gpsdb admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 – Production on 21-DEC-2015 16:08:59

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=gpsdb)(PORT=1521)))

STATUS of the LISTENER

————————

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.4.0 – Production

Start Date 11-DEC-2015 14:19:59

Uptime 10 days 1 hr. 49 min. 0 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File /u01/app/oracle/diag/tnslsnr/gpsdb/listener/alert/log.xml

Listening Endpoints Summary…

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=gpsdb)(PORT=1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary…

Service “DUMMY” has 1 instance(s).

Instance “trsen”, status BLOCKED, has 1 handler(s) for this service…

Service “catadb” has 1 instance(s).

Instance “catadb”, status READY, has 1 handler(s) for this service…

The command completed successfully

[oracle@gpsdb admin]$ rman target sys/oracle catalog rcowner/oracle@catadb;

Recovery Manager: Release 11.2.0.4.0 – Production on Mon Dec 21 16:09:10 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: DUMMY (not mounted)

connected to recovery catalog database

RMAN> restore spfile from autobackup;

Starting restore at 21-DEC-15

configuration for DISK channel 2 is ignored

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=1576 device type=DISK

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20151221

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20151220

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20151219

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20151218

channel ORA_DISK_1: AUTOBACKUP found: /oradata/bk1/c-3731845208-20151218-15

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /oradata/bk1/c-3731845208-20151218-15

channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete

Finished restore at 21-DEC-15

2、参数文件丢失,但实例没有crash,可以采用:

RMAN> restore spfile to ‘/tmp/trsen_init_20151221.ora’ from autobackup;

Starting restore at 21-DEC-15

using channel ORA_DISK_1

recovery area destination: /oradata/db_recovery_dest

database name (or database unique name) used for search: TRSEN

channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20151221

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20151220

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20151219

channel ORA_DISK_1: looking for AUTOBACKUP on day: 20151218

channel ORA_DISK_1: AUTOBACKUP found: /oradata/bk1/c-3731845208-20151218-15

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /oradata/bk1/c-3731845208-20151218-15

channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete

Finished restore at 21-DEC-15

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Oracle数据库的SPFILE(Server Parameter File)是一个二进制文件,它包含了数据库实例的配置参数。这些参数用于控制数据库的行为和性能。下面是一些常见的SPFILE参数及其解释: 1. `DB_NAME`:数据库实例的名称。 2. `DB_UNIQUE_NAME`:数据库实例的唯一名称,用于集群环境中区分不同实例。 3. `DB_DOMAIN`:数据库的域名,用于在网络中唯一标识数据库。 4. `CONTROL_FILES`:控制文件的路径和名称,控制文件记录了数据库的结构和元数据信息。 5. `LOG_ARCHIVE_DEST_n`:归档日志的存储位置,可以有多个归档目标。 6. `LOG_ARCHIVE_FORMAT`:归档日志的命名格式。 7. `SGA_TARGET`:系统全局区(SGA)的目标大小,SGA是Oracle数据库中的主要内存区域。 8. `PGA_AGGREGATE_TARGET`:PGA(Program Global Area)的目标大小,PGA用于存储会话和排序操作的临时数据。 9. `MEMORY_TARGET`:SGA和PGA的总目标大小,如果设置了该参数,则SGA_TARGET和PGA_AGGREGATE_TARGET会自动调整。 10. `FAST_START_MTTR_TARGET`:最小恢复时间目标,用于控制崩溃恢复的速度。 11. `PROCESSES`:允许的并发用户进程数量。 12. `SESSIONS`:允许的并发会话数量。 13. `REMOTE_LOGIN_PASSWORDFILE`:用于远程登录认证的密码文件。 14. `UNDO_MANAGEMENT`:事务回滚管理方式,可以是AUTO(自动管理)或MANUAL(手动管理)。 15. `COMPATIBLE`:数据库版本兼容性级别,控制数据库的行为以与特定版本兼容。 这只是一小部分SPFILE参数的示例,实际上还有很多其他参数可以配置。您可以通过查阅Oracle官方文档或使用`SHOW PARAMETER`命令来获取更详细的参数列表和解释。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值