怎样测试oracle11g安装完成Olinux7.1环境上安装Oracle11.2.0.3(关键是你的恢复用的主机数据库版本要与生成备份文件的服务器的数据库版本一致,完全一致!)
注意:Olinux7.1已经没有pdksh的发布包了,CentOS5的包在Olinux7.1下安装没有问题。
需要安装pdksh包,这个包在Linux Redhat5的发行版本里面有:
wget
/centos/5/os/x86_64/CentOS/pdksh-5.2.14-37.el5_8.1.x86_ 64.rpm
如果发现原数据库目录结构与新安装数据库目录结构不一致,如:
原数据库路径:
/app/oracle/product/112
新数据库路径:
/app/oracle/product/11.2.0/db_1
则需要通过软链接实现对目录一致的目标
archlg目录的创建,由于分区空间关系,我们将archlg目录创建在/app分区上
创建相应的软链接:
ln-s/app/archlg//archlg
============================================
开始获取备份文件,全量备份文件一般包括四个文件,例如:
c-2443477272-20161104-00
level0_DIANSHAN_20161104_3343_1_8frk1frh.bak
level0_DIANSHAN_20161104_3344_1_8grk1frh.bak
log_DIANSHAN_20161104_3345_1_8hrk1g70.bak
注意:其中c-开头的文件里面是存放的spfile和controlfile
注意:事先获取源数据库的DBID,在备份源机器上执行rman target/
本次获得:DBID=2443477272
开始:
export ORCLE_SID=dbtest
[oracle@reportdb/]$rman target/
RMAN>startup nomount;
RMAN>set dbid2443477272;
RMAN>restore spfile from'/archlg/backup/c-2443477272-20161104-00';
RMAN>shutdown
RMAN>exit
这里由于恢复的服务器内存少于原服务器,因此,需要调整pfile和spfile的配置。sqlplus"/as sysdba"
SQLPLUS>startup nomount
SQLPLUS>exit
这里会出现失败的情况,多数原因是路径不存在造成的。查询启动日志会发现问题。
启动失败后要kill掉smon进程:
ps-ef|grep smon
kill-9pid
首先确保$ORACLE_BASE路径下的./diag/rdbms/$ORACLE_SID目录的存在,
如果以上目录不存在就从同级目录下的另外目录复制一份与SID一致的名称的目录
如:cp-r./dbtest_pd dbtest
确认新建的dbtest路径中有adump目录。没有就手工建立。
检查日志:$ORACLE_BASE/diag/rdbms/dbtest/trace
在这个目录下查看最新的日志:
[oracle@reportdb trace]$tail-100alert_dbtest.log
会发现数据库实例不能进入的真正原因。一般是路径问题。
解决路径问题以后,一般SQLPLUS能把数据库拉起来。
再次尝试nomount方式启动数据库。
sqlplus"/as sysdba"
SQL>startup nomount
ORACLE instance started.
Total System Global Area1.4999E+10bytes
Fixed Size2242952bytes
Variable Size6442452600bytes
Database Buffers852*******bytes
Redo Buffers31150080bytes
SQL>create pfile from spfile;
File created.
SQL>exit
这样就创建了pfile文件。
接着停止实例:
[oracle@reportdb trace]$sqlplus"/as sysdba"
SQL*Plus:Release11.2.0.3.0Production on Thu Nov323:57:312016
Copyright(c)1982,2011,Oracle.All rights reserved.
Connected to:
Oracle Database11g Enterprise Edition Release11.2.0.3.0-64bit Production With the Partitioning,OLAP,Data Mining and Real Application Testing options
SQL>shutdown immediate
ORA-01507:database not mounted
ORACLE instance shut down.
SQL>exit
编辑$ORACLE_HOME/dbs/a文件
其中双下划线部分配置删除,除其中带路径的部分。
以下是生成的文件:
dbtest.__db_cache_size=852*******
dbtest.__java_pool_size=201326592
dbtest.__large_pool_size=33554432
dbtest.__pga_aggregate_target=5033164800
dbtest.__sga_target=150********
dbtest.__shared_io_pool_size=0
dbtest.__shared_pool_size=6174015488
dbtest.__streams_pool_size=33554432
*.fal_client='dbtest_pd'
*.fal_server='dbtest_st,DG12771'
*.log_archive_dest_2='service=DG71reopen=120lgwr async
valid_for=(online_logfiles,primary_role)db_unique_name=dbtest_st'
*.log_archive_dest_3='service=DG12771lgwr async reopen=120NET_TIMEOUT=10 COMPRESSION=ENABLE valid_for=(online_logfiles,primary_role)
db_unique_name=DG12771'
*.log_archive_dest_state_2='enable'
*.log_archive_dest_state_3='enable'
dbtest.__oracle_base='/app/oracle'#ORACLE_BASE set from environment
*.audit_file_dest='/app/oracle/admin/dbtest/adump'
*.audit_trail='none'
*patible='11.2.0.0.0'
*.control_files='/app/oracle/oradata/l','/app/oracle/fast_re covery_area/l'
*.db_block_size=8192
*.db_domain=''
*.db_name='dianshan'
*.db_recovery_file_dest_size=4322230272
*.db_recovery_file_dest='/archlg/flash'
*.db_unique_name='dbtest_pd'
*.diagnostic_dest='/app/oracle'
*.dispatchers='(PROTOCOL=TCP)(SERVICE=dbtestXDB)'
*.filesystemio_options='SETALL'
*.job_queue_processes=1000
*.log_archive_config='dg_config=(dbtest_pd,dbtest_st,DG12771)'
*.log_archive_dest_1='location=/archlg/archlog
valid_for=(all_logfiles,all_roles)db_unique_name=dbtest_pd'
*.log_archive_dest_state_1='enable'
*.log_archive_format='arch_%t_%s_%r.arc'
*.open_cursors=3000
*.pga_aggregate_target=2520581888
*.processes=200
*.remote_login_passwordfile='EXCLUSIVE'
*.service_names='dbtest_PD'
*.sga_target=7061745664
*.standby_file_management='auto'
*.undo_tablespace='UNDOTBS1'
修改后的文件:
dbtest.__oracle_base='/app/oracle'#ORACLE_BASE set from environment
*.audit_file_dest='/app/oracle/admin/dbtest/adump'
*.audit_trail='none'
*patible='11.2.0.0.0'
*.control_files='/app/oracle/oradata/l','/app/oracle/fast_re covery_area/l'
*.db_block_size=8192
*.db_domain=''
*.db_name='dianshan'
*.db_recovery_file_dest_size=4322230272
*.db_recovery_file_dest='/archlg/flash'
*.db_unique_name='dbtest_pd'
*.diagnostic_dest='/app/oracle'
*.dispatchers='(PROTOCOL=TCP)(SERVICE=dbtestXDB)'
*.filesystemio_options='SETALL'
*.job_queue_processes=1000
*.log_archive_config='dg_config=(dbtest_pd,dbtest_st,DG12771)'
*.log_archive_dest_1='location=/archlg/archlog
valid_for=(all_logfiles,all_roles)db_unique_name=dbtest_pd'
*.log_archive_dest_state_1='enable'
*.log_archive_format='arch_%t_%s_%r.arc'
*.open_cursors=3000
*.pga_aggregate_target=2520581888
*.processes=200
*.remote_login_passwordfile='EXCLUSIVE'
*.service_names='dbtest_PD'
*.sga_target=7061745664
*.standby_file_management='auto'
*.undo_tablespace='UNDOTBS1'
关键是要调整内存相关的参数。保证启动后资源配置满足需要。这里的例子中,源数据库是32GB内存,目标数据库是16GB内存,各位要参考处理。
pfile文件中涉及到的路径需要单独检查一遍,如果不存在要手动创建,使用mkdir-p指令。
确保数据库shutdown的情况下,从pfile将配置更新到spfile:
[oracle@reportdb dbs]$sqlplus"/as sysdba"
SQL*Plus:Release11.2.0.3.0Production on Thu Nov323:59:332016
Copyright(c)1982,2011,Oracle.All rights reserved.
Connected to an idle instance.
SQL>startup nomount pfile='/app/oracle/product/11.2.0/db_1/a'; ORACLE instance started.
Total System Global Area7031664640bytes
Fixed Size2241824bytes
Variable Size1174407904bytes
Database Buffers5838471168bytes
Redo Buffers16543744bytes
SQL>create spfile from pfile;
File created.
SQL>shutdown immediate
ORA-01507:database not mounted
ORACLE instance shut down.
SQL>exit
现在重新恢复control文件:
[oracle@reportdb dbs]$cd/
[oracle@reportdb/]$ls
app archlg bin boot dev etc home lib lib64media mnt opt proc root run sbin srv sys tmp usr var
[oracle@reportdb/]$rman target/
Recovery Manager:Release11.2.0.3.0-Production on Fri Nov400:24:342016
Copyright(c)1982,2011,Oracle and/or its affiliates.All rights reserved.
connected to target database(not started)
RMAN>startup nomount;
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论