您的位置:首页 > 数据库 > Oracle

安装ORACLE10.2.0.1.0,然后升级到10.2.0.4.0,然后恢复数据库(在RAC ASM文件系统恢复到单机文件系统)(实战)

2017-08-19 22:18 1201 查看
要备份生产库(原库)的数据:生产库配置Oracle10.2.0.4.0,64位,采用rac的asm文件系统 ,数据库名称:racdb

目标库:单机文件系统。

实现步骤:第一步安装Oracle10.2.0.1.0数据库,然后升级到Oracle10.2.0.4.0,因为是rac的asm文件系统转为单机文件系统,rman恢复之前需要打补丁

p7207932_10204_Linux-x86-64.zip,在用备份进行恢复数据库。

(数据库版本要一致,位数要一致,数据库名称要一致。等等)

Linux(centos6.5)安装oracle10G_64位

数据库下载地址:

 
http://download.oracle.com/otn/linux/oracle10g/10201/10201_database_linux_x86_64.cpio.gz
 
http://mirrors.163.com/.help/CentOS6-Base-163.repo
 

1.配置网易163的yum源:

 

# cd /etc/yum.repos.d/

 

# mv /home/www/ftpfile/CentOS6-Base-163.repo CentOS-Base.repo

 

2. 更新yum源:

 

# yum clean all

 

# yum makecache

 

# yum update

 

3. 下载必须安装包:

 

# yum -y install binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-common 

glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-

devel make sysstat

# yum install libXp

# yum -y install libXp.i686

# yum -y install libXt.i686

# yum -y install libXtst.i686

4. 修改 sysctl.conf 配置文件:

 

# vim /etc/sysctl.conf

 

   在文件末尾添加一下内容:

 

#use for Oracle

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default = 4194304

net.core.rmem_max = 4194304

net.core.wmem_default = 262144

net.core.wmem_max = 262144

 

立即执行修改:

 

# sysctl -p

 

5. 修改 limits.conf 配置文件. 此文件用于设置系统资源限制.

 

# vi /etc/security/limits.conf

 

在文件末尾加上以下内容:

 

oracle soft nproc 2047

oracle hard nproc 16384

oracle soft nofile 1024

oracle hard nofile 65536

 

6. 编辑 /etc/pam.d/login 文件:

 

# vi /etc/pam.d/login

 

在文件末尾加上以下内容:

 

session required /lib/security/pam_limits.so

session required pam_limits.so

 

7. 创建相应的用户名和用户组:

 

# groupadd oinstall

 

# groupadd dba

 

# useradd -g oinstall -G dba oracle

 

修改密码:

 

# passwd oracle

 

8. 修改 /etc/profile 限制其他用户使用:

 

# vim /etc/profile

 

在文件末尾加入以下内容:

 

if [ $USER = "oracle" ]; then

    if [ $SHELL = "/bin/ksh" ]; then

        ulimit -p 16384

        ulimit -n 65536

    else

        ulimit -u 16384 -n 65536

    fi

fi

 

注意: 如果文件是不能修改的. 保存时输入 :wq! 强制保存.

 

9. 修改Linux 发行版本. 因为Oracle10G发行的时候, Centos6.5还没有发行. 所以必须修改:

 

# vim /etc/redhat-release

 

删除文件本身内容, 重新录入以下内容:

 

redhat-4

 

10. 创建oralce安装目录以及数据存放目录.

 

# mkdir -p /software/app/oracle/

 

# chown -R oracle:oinstall /software/app/oracle/

 

# chmod -R 775 /software/app/oracle/

 

11.  配置Oracle用户环境变量:

 

# vi /home/oracle/.bash_profile

 

在文件末尾加入以下内容:

 

#Oracle Settings

export TMP=/tmp;

export TMPDIR=$TMP;

export ORACLE_BASE=/software/app/oracle;

export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1;

export ORACLE_SID=orcl;

export ORACLE_TERM=xterm;

export PATH=/usr/sbin:$PATH;

export PATH=$ORACLE_HOME/bin:$PATH;

export
19559
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib;

export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib;

12. 使配置生效:

 

# source /home/oracle/.bash_profile

 

13. 解压安装文件:

 

将下载的10201_database_linux_x86_64.cpio.gz(数据库安装文件) 复制到 /software/app/oracle/目录下.

 

我是从FTP目录下复制过去.

 

# cp /home/www/ftpfile/10201_database_linux_x86_64.cpio.gz /software/app/oracle/

 

14. 解压安装包:

 

首先解压gz包.

 

# gzip -d 10201_database_linux_x86_64.cpio.gz

 

在使用cpio解压出文件.

 

# cpio -idmv < 10201_database_linux_x86_64.cpio

 

15. 更改解压出来的database文件件及文件的所有者和用户组为oracle和oinstall.

 

# chown -R oracle:oinstall /software/app/oracle/database/

 

16. 切换到oralce 用户, 进行数据库的安装:

 

# su - oracle

 

注意: 此处加 - 是为了切换环境变量.

 

17. 执行安装:

 

$ cd /software/app/oracle/database/

 

$ ./runInstaller

 

注意: 如果执行此命令时出现此错误(DISPLAY not set. Please set the DISPLAY and try again):

 

切换回root用户. 

 

# su

 

# export DISPLAY=:0.0

 

# xhost +

 

执行完成后, 再次切换回 (# su - oracle) oracle用户执行 ./runInstaller.

 

注意: 如果安装时出现以下错误: (libXp.so.6)

 

切换到root用户, 执行:

 

# yum -y install libXp.i686

 

注意: 如果安装时出现以下错误: (libXt.so.6)

 

# yum -y install libXt.i686

 

注意: 如果安装时出现以下错误: (libXtst.so.6)

 

#yum -y install libXtst.i686

 

Oracle安装必须使用界面安装. 执行 ./runInstaller 之后就会弹出安装界面. 用户进行选择安装.

 

安装步骤:

 

1.

 

这里选高级安装.

 

2.

 

选择证书存放目录, 这里不用选择, 系统已经自动填充了. 直接下一步.

 

3.

 

选择企业版, 选择语言为英文和简体中文.

 

4.

 

选择安装目录, 因为在oralce用户的环境变量里已经指定了($ vim /home/oracle/.bash_profile). 这里会自动填充. 

 

5. 

 

执行安装前检查.

 

6. 

 

这里选择创建数据库.

 

7. 

 

这里选择一般用途.

 

8.

 

这里一定要注意, 要修改数据库字符集编码.  其他的不选.

 

9.

 

直接下Next

 

10.

 

直接Next

 

11.

 

设置数据库连接密码.

 

12.

 

显示安装概要. 直接安装.

 

13.

 

安装到65%的时候会出现这个错误. 据了解是安装程序的一个BUG. 直接选Continue(继续安装)

 

14.

 

主机映射名称错误, 需要root用户修改hosts映射.

 

# vim /etc/hosts

 

在文件末尾添加以下内容:

 

# 主机地址 主机名称

 

192.168.1.244 letcore.server

 

15.

 

解决:

 

另外开一个终端. 连接root用户, 修改内核参数.

 

# id oracle

 

可以看到oracle的组dba id 为 501

 

注意: 此处为dba组的id, 不然可能下次进入服务器的时候. 无法启动数据库.

 

修改内核参数:

 

echo "501" > /proc/sys/vm/hugetlb_shm_group

 

修改完毕后点击Igonre

 

完毕之后如果没有进行下一步.点击retry 重新进行安装就行.

 

16. 以上省略了一部分页面. 全部选择默认就OK

 

此页面. 需要用户另外开启一个终端. 使用root用户连接. 执行图中给出的两个sh文件.

 

# cd /software/app/racle/oraInventory/

 

# ./orainstRoot.sh

 

# sh +x /software/app/racle/product/10.2.0/db_1/root.sh

 

17.

 

终于执行完成了.

 

18.

 

校验安装是否成功.

 

连接地址: 127.0.0.1:5560/isqlplus/

 

或者: 主机名:5560/isqlplus/ 如: letcore.server:5560/isqlplus/

 

使用:

 

$ lsnrctl status 查看数据库监听状态.

 

$ lsnrctl start 开启监听.

 

$ lsnrctl stop 关闭监听.

 

数据库安装完成后, 登陆数据库. 建立表空间, 建立用户等操作.

 

全部使用oralce用户操作.

 

1. 创建表空间存放目录:

 

$ mkdir /software/app/oracle/oradata/tablespace/

 

2. 连接sqlplus:

 

$ sqlplus "/ as sysdba"

 

3. 建立临时表空间:

 

create temporary tablespace temp_tablespase tempfile'/software/app/oracle/oradata/tablespace/temp_tablespase.dbf' size 1024m autoextend on next 100m 

maxsize 10240m extent management local;

 

4. 建立数据表空间:

 

create tablespace test_tablespace logging datafile'/software/app/oracle/oradata/tablespace/test_tablespace.dbf' size 1024m autoextend on next 100m 

maxsize 10240m extent management local;

 

5. 建立用户:

 

create user zoooq identified by zoooq default tablespace test_tablespace temporary tablespace temp_tablespase;

 

6. 赋值权限:

 

grant dba to zoooq;

 

最后一步. 使用在windows平台下使用PL-SQL连接数据库:

 

输入用户名和密码, 

 

在数据库选项中输入: 192.168.1.244:1521/ORCL

 

进行连接.

 

使用PL-SQL连接数据库时容易出现的错误:

 

ORA-12170:TNS:连接超时

 

此错误有可能是因为服务器的防火墙阻止了用户连接.

 

# service iptables stop

 

重启服务器后. 重新启动数据库:

 

#  su – oracle

 

$  sqlplus "/as sysdba"

 

SQL>startup

 

SQL>exit

 

$ lsnrctl start

---------------------------10.2.0.1.0升级操作10.2.0.4.0----------------

查看升级之前的信息

[oracle@chenanzhen-oracle-test2 Disk1]$ sqlplus / as sysdba;

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 11 08:59:26 2017

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production

With the Partitioning, OLAP and Data Mining options

版本信息

SQL> select * from  v$version;

BANNER

----------------------------------------------------------------

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bi

PL/SQL Release 10.2.0.1.0 - Production

CORE 10.2.0.1.0
Production

TNS for Linux: Version 10.2.0.1.0 - Production

NLSRTL Version 10.2.0.1.0 - Production

SQL> select name from v$datafile;

NAME

--------------------------------------------------------------------------------

/opt/oracle/app/oracle/oradata/BOLO1021/system01.dbf

/opt/oracle/app/oracle/oradata/BOLO1021/undotbs01.dbf

/opt/oracle/app/oracle/oradata/BOLO1021/sysaux01.dbf

/opt/oracle/app/oracle/oradata/BOLO1021/users01.dbf

SQL> select member from v$logfile;

MEMBER

--------------------------------------------------------------------------------

/opt/oracle/app/oracle/oradata/BOLO1021/redo03.log

/opt/oracle/app/oracle/oradata/BOLO1021/redo02.log

/opt/oracle/app/oracle/oradata/BOLO1021/redo01.log

SQL> select name  from v$controlfile;

NAME

--------------------------------------------------------------------------------

/opt/oracle/app/oracle/oradata/BOLO1021/control01.ctl

/opt/oracle/app/oracle/oradata/BOLO1021/control02.ctl

/opt/oracle/app/oracle/oradata/BOLO1021/control03.ctl

SQL> archive log list;

Database log mode       No Archive Mode

Automatic archival       Disabled

Archive destination       USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     1

Current log sequence       2

1:停止数据库以及相关服务

[oracle@chenanzhen-oracle-test2 Disk1]$ emctl stop dbconsole

TZ set to PRC

Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0  

Copyright (c) 1996, 2005 Oracle Corporation.  All rights reserved.
http://chenanzhen-oracle-test2:5500/em/console/aboutApplication
Stopping Oracle Enterprise Manager 10g Database Control ... 

 ...  Stopped. 

停 SQLplus

[oracle@chenanzhen-oracle-test2 Disk1]$ isqlplusctl stop

iSQL*Plus 10.2.0.1.0

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Stopping iSQL*Plus ...

iSQL*Plus stopped.

停监听

[oracle@chenanzhen-oracle-test2 Disk1]$ lsnrctl stop

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 11-JAN-2017 09:11:01

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC2)))

The command completed successfully

[oracle@chenanzhen-oracle-test2 Disk1]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 11 09:12:31 2017

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to:

Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - 64bit Production

With the Partitioning, OLAP and Data Mining options

SQL> shutdown immediate;  (这个要关闭,不然进程还在,安装不过去)

Database closed.

Database dismounted.

ORACLE instance shut down.

2:冷备份数据库

备份 数据文件,日志文件,控制文件

[oracle@chenanzhen-oracle-test2 BOLO1021]$ ls

control01.ctl  control03.ctl  redo02.log  sysaux01.dbf  temp01.dbf     users01.dbf

control02.ctl  redo01.log     redo03.log  system01.dbf  undotbs01.dbf

[oracle@chenanzhen-oracle-test2 ora10g]$ mkdir shenji_backup_10.2.0.1.1

备份文件数据文件,日志文件,控制文件到备份目录

[oracle@chenanzhen-oracle-test2 BOLO1021]$ cp  *  /opt/ora10g/shenji_backup_10.2.0.1.1

备份 口令文件,spfile文件

[oracle@chenanzhen-oracle-test2 shenji_backup_10.2.0.1.1]$ cd $ORACLE_HOME/dbs

[oracle@chenanzhen-oracle-test2 dbs]$ ls

hc_BOLO1021.dat  initdw.ora  init.ora  lkBOLO1021  orapwBOLO1021  spfileBOLO1021.ora

 

[oracle@chenanzhen-oracle-test2 dbs]$cp orapwBOLO1021  spfileBOLO1021.ora   /opt/ora10g/shenji_backup_10.2.0.1.1

3:配置并运行安装脚本

  3.1 之处采用静默安装

[oracle@chenanzhen-oracle-test2 ora10g]$ ls

10201_database_linux_x86_64.cpio  Disk1                            README.html

database                          p6810189_10204_Linux-x86-64.zip  shenji_backup_10.2.0.1.1

[oracle@chenanzhen-oracle-test2 ora10g]$ cd Disk1/

[oracle@chenanzhen-oracle-test2 Disk1]$ ls

10204_buglist.htm  install  patch_note.htm  response  runInstaller  stage

[oracle@chenanzhen-oracle-test2 Disk1]$ cd response/

[oracle@chenanzhen-oracle-test2 response]$ ls

patchset.rsp

[oracle@chenanzhen-oracle-test2 response]$ cp -a patchset.rsp patchset.rsp.old   (-a 表示复制保留原来文件同样的所有属性)

[oracle@chenanzhen-oracle-test2 response]$ ls

patchset.rsp  patchset.rsp.old

编辑文件,修改一下内容

[oracle@chenanzhen-oracle-test2 response]$ vi patchset.rsp

UNIX_GROUP_NAME=oinstall   

#安装用户组为oinstall

FROM_LOCATION=/opt/ora10g/Disk1/stage/products.xml

#升级patch包的路径(以自己机子里面的路径为准)

ORACLE_HOME=/opt/oracle/app/oracle/product/10.2/db_1

#oracle_home的路径,环境变量[oracle@chenanzhen-oracle-test2 Disk1]$ env | grep ORACLE下的Oracle_home

ORACLE_HOME_NAME=OraDb10g_home2

#找到<HOME NAME="OraDb10g_home2" LOC="/opt/oracle/app/oracle/product/10.2/db_1" TYPE="O" IDX="2"/>,loc为该数据库的安装目

#录,填这个值OraDb10g_home2

#[oracle@chenanzhen-oracle-test2 ContentsXML]$ ls

#comps.xml  inventory.xml  libs.xml

#[oracle@chenanzhen-oracle-test2 ContentsXML]$ pwd

#/home/oracle/oraInventory/ContentsXML

#[oracle@chenanzhen-oracle-test2 ContentsXML]$ cat inventory.xml 

#<?xml version="1.0" standalone="yes" ?>

#<!-- Copyright (c) 2005 Oracle Corporation. All rights Reserved -->

#<!-- Do not modify the contents of this file by hand. -->

#<INVENTORY>

#<VERSION_INFO>

#   <SAVED_WITH>10.2.0.1.0</SAVED_WITH>

#   <MINIMUM_VER>2.1.0.6.0</MINIMUM_VER>

#</VERSION_INFO>

#<HOME_LIST>

#<HOME NAME="OraDb10g_home1" LOC="/home/oracle/oracle/product/10.2.0/db_1" TYPE="O" IDX="1"/>

#<HOME NAME="OraDb10g_home2" LOC="/opt/oracle/app/oracle/product/10.2/db_1" TYPE="O" IDX="2"/>

#</HOME_LIST>

#</INVENTORY>

3.1.2

安装升级软件/opt/ora10g/Disk1/response/patchset.rsp指定用这个文件

切换到Disk1目录

[oracle@chenanzhen-oracle-test2 Disk1]$ ./runInstaller -silent -responseFile /opt/ora10g/Disk1/response/patchset.rsp

以root身份运行

[root@chenanzhen-oracle-test2 ~]$ cd /opt/oracle/app/oracle/product/10.2/db_1   #$ORACLE_HOME

[root@chenanzhen-oracle-test2 db_1]# ./root.sh   (一路按y,覆盖原来文件)

[root@chenanzhen-oracle-test2 db_1]# ./root.sh

Running Oracle10 root.sh script...

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /opt/oracle/app/oracle/product/10.2/db_1

Enter the full pathname of the local bin directory: [/usr/local/bin]: 

The file "dbhome" already exists in /usr/local/bin.  Overwrite it? (y/n) 

: y

   Copying dbhome to /usr/local/bin ...

The file "oraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

: y

   Copying oraenv to /usr/local/bin ...

The file "coraenv" already exists in /usr/local/bin.  Overwrite it? (y/n) 

: y

   Copying coraenv to /usr/local/bin ...

4:手工升级数据库(以Oracle身份)

环境变量

[oracle@chenanzhen-oracle-test2 Disk1]$ env | grep ORACLE

ORACLE_SID=BOLO1021

ORACLE_BASE=/opt/oracle/app/oracle

ORACLE_HOME=/opt/oracle/app/oracle/product/10.2/db_1

设置好环境变量文件三个参数和环境变量一致

[oracle@chenanzhen-oracle-test2 ~]$ cat .bash_profile 

ORACLE_SID=BOLO1021

ORACLE_BASE=/opt/oracle/app/oracle

ORACLE_HOME=/opt/oracle/app/oracle/product/10.2/db_1

4.1 运行utlu102i.sql和catupgrd.sql脚本

4.1.1启动数据库的upgrade模式

[oracle@chenanzhen-oracle-test2 response]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 11 10:05:40 2017

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

#启动到升级模式

SQL> startup upgrade;

ORACLE instance started.

Total System Global Area  557842432 bytes

Fixed Size    2022280 bytes

Variable Size  163579000 bytes

Database Buffers  385875968 bytes

Redo Buffers    6365184 bytes

Database mounted.

Database opened.

#设置日志

SQL> SPOOL upgrade_info.log  #升级运行的日志文件路径/opt/ora10g/Disk1/response/upgrade_info.log

#运行升级前信息工具

SQL> @?/rdbms/admin/utlu102i.sql

Oracle Database 10.2 Upgrade Information Utility    01-11-2017 10:07:45

.

**********************************************************************

Database:

**********************************************************************

--> name: BOLO1021

--> version: 10.2.0.1.0

--> compatible: 10.2.0.1.0

.

Database already upgraded; to rerun upgrade use rdbms/admin/catupgrd.sql.

PL/SQL procedure successfully completed.

#关闭日志输出

SQL> SPOOL OFF

启动监听:另外开个连接

[oracle@chenanzhen-oracle-test2 ~]$ lsnrctl start

运行catupgrd.sql脚本

SQL> @?/rdbms/admin/catupgrd.sql

报错1:

No errors.

SELECT version_script AS file_name FROM DUAL

       *

ERROR at line 1:

ORA-20000: Upgrade re-run not supported from version

ORA-06512: at "SYS.VERSION_SCRIPT", line 45

解决方法:

通过以下SQL更新到你要升级到的版本:10.2.0.1升级到10.2.0.4执行catupgrd.sql报错----BUG 

update registry$ set prv_version='10.2.0.4.0' where cid='CATPROC';

quit退出会话,再conn /as sysdba连接到数据库 

再次运行, 不会报错

报错2:

ERROR at line 1:

ORA-03113: end-of-file on communication channel

SQL> 

SQL> alter system flush shared_pool;

ERROR:

ORA-03114: not connected to ORACLE

[oracle@chenanzhen-oracle-test2 response]$ sqlplus / as sysdba

SQL>update registry$ set prv_version='10.2.0.4.0' where cid='CATPROC';

sql>exit;

[oracle@chenanzhen-oracle-test2 response]$ sqlplus / as sysdba

SQL> @?/rdbms/admin/catupgrd.sql  #请待定。。时间较长,直到出现sql> –升级脚本[刷新数据字典]    #版本要是最新版本10.2.0.4.0,status要是valid

No errors.

No errors.

TIMESTAMP

--------------------------------------------------------------------------------

COMP_TIMESTAMP RUL        2017-01-11 10:40:53

DBUA_TIMESTAMP RUL        VALID       2017-01-11 10:40:53

TIMESTAMP

--------------------------------------------------------------------------------

COMP_TIMESTAMP UPGRD_END  2017-01-11 10:40:53

.

Oracle Database 10.2 Upgrade Status Utility           01-11-2017 10:40:53

.

Component                                Status         Version  HH:MM:SS

JServer JAVA Virtual Machine              VALID      10.2.0.4.0  00:14:56

Oracle XDK                                VALID      10.2.0.4.0  00:00:33

Oracle Database Java Packages             VALID      10.2.0.4.0  00:00:31

Oracle Text                               VALID      10.2.0.4.0  00:00:12

Oracle XML Database                       VALID      10.2.0.4.0  00:00:10

Oracle Workspace Manager                  VALID      10.2.0.4.3  00:00:21

Oracle Data Mining                        VALID      10.2.0.4.0  00:00:17

OLAP Analytic Workspace                   VALID      10.2.0.4.0  00:00:00

OLAP Catalog                              VALID      10.2.0.4.0  00:00:56

Oracle OLAP API                           VALID      10.2.0.4.0  00:01:05

Oracle interMedia                         VALID      10.2.0.4.0  00:02:50

Spatial                                   VALID      10.2.0.4.0  00:00:00

Oracle Expression Filter                  VALID      10.2.0.4.0  00:00:17

Oracle Enterprise Manager                 VALID      10.2.0.4.0  00:00:46

Oracle Rule Manager                       VALID      10.2.0.4.0  00:00:09

.

Total Upgrade Time: 00:23:09

DOC>#######################################################################

DOC>#######################################################################

DOC>

DOC>   The above PL/SQL lists the SERVER components in the upgraded

DOC>   database, along with their current version and status.

DOC>

DOC>   Please review the status and version columns and look for

DOC>   any errors in the spool log file.  If there are errors in the spool

DOC>   file, or any components are not VALID or not the current version,

DOC>   consult the Oracle Database Upgrade Guide for troubleshooting

DOC>   recommendations.

DOC>

DOC>   Next shutdown immediate, restart for normal operation, and then

DOC>   run utlrp.sql to recompile any invalid application objects.

DOC>

DOC>#######################################################################

DOC>#######################################################################

DOC>#

SQL> 

#关闭日志输出

SQL> SPOOL OFF

4.2检查path.log中的错误,如果有错误重新运行catupgrd.qsl  #升级运行的日志文件路径/opt/ora10g/Disk1/response/upgrade_info.log

sql>shutdown immediate;

sql>startup;

5:重新编译无效的对象

sql>@?/rdbms/admin/utlrp.sql;   #耐心待定,直到出现sql>

OBJECTS WITH ERRORS

-------------------

                  0

DOC> The following query reports the number of errors caught during

DOC> recompilation. If this number is non-zero, please query the error

DOC> messages in the table UTL_RECOMP_ERRORS to see if any of these errors

DOC> are due to misconfiguration or resource constraints that must be

DOC> fixed before objects can compile successfully.

DOC>#

ERRORS DURING RECOMPILATION

---------------------------

                          0

SQL> 

6检查组件的升级情况

SQL> select  *  from  UTL_RECOMP_ERRORS;

SQL> col  comp_name format  a30;

SQL> col version format a20;

sql> col status  format  a20;

sql> set line 200;

sql> select comp_name,version,status from  sys.dba_registry;

显示的值为valid, 表示成功完成升级。如图显示:

SQL> select comp_name,version,status from  sys.dba_registry;  #版本要是最新版本10.2.0.4.0,status要是valid

COMP_NAME                      VERSION              STATUS

------------------------------ -------------------- --------------------

Oracle Database Catalog Views  10.2.0.4.0           VALID

Oracle Database Packages and Types 10.2.0.4.0           VALID

Oracle Workspace Manager       10.2.0.4.0           VALID

JServer JAVA Virtual Machine   10.2.0.4.0           VALID

Oracle XDK                     10.2.0.4.0           VALID

Oracle Database Java Packages  10.2.0.4.0           VALID

Oracle Expression Filter       10.2.0.4.0           VALID

Oracle Data Mining             10.2.0.4.0           VALID

Oracle Text                    10.2.0.4.0           VALID

Oracle XML Database            10.2.0.4.0           VALID

Oracle Rule Manager            10.2.0.4.0           VALID

Oracle interMedia              10.2.0.4.0           VALID

OLAP Analytic Workspace        10.2.0.4.0           VALID

Oracle OLAP API                10.2.0.4.0           VALID

OLAP Catalog                   10.2.0.4.0           VALID

Spatial                        10.2.0.4.0           VALID

Oracle Enterprise Manager      10.2.0.4.0           VALID

查看数据,表空间,用户等等

sql>select tablespace_name,status from dba_tablespaces;

sql>select  username from dba_user;

sql>select object_name from  dba_objects where owner='SCOTT';  

SQL> select * from test_t;

        ID NAME

---------- ------------

         1 anzhen

         1 2017/01/11

检查是否有无效对象

SQL> select count(*) from dba_objects where status='INVALID';

  COUNT(*)

----------

         0

检查是否有无效的对象。

Sql>select object_name,status from dba_objects where object_Name in ('SYS','SYSTEM') and status = 'INVALID';

如果值大于0则说明有错误,就要重新执行sql>@d:/oracle/product/10.2.0/db_1/rdbms/admin/catupgrd.sql,知道没有错误

更新EM资料库

[oracle@chenanzhen-oracle-test2 response]$ emca -upgrade db

STARTED EMCA at Jan 11, 2017 11:01:45 AM

EM Configuration Assistant, Version 10.2.0.1.0 Production

Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:

ORACLE_HOME for the database to be upgraded: /opt/oracle/app/oracle/product/10.2/db_1

Database SID: racdb

Listener port number: 1521

Do you wish to continue? [yes(Y)/no(N)]: y

# 查看版本

SQL> select * from  v$version;

#重启监听,对外服务

[oracle@chenanzhen-oracle-test2 ~]$ lsnrctl start

升级完毕!

--------

ORACLE Version 10.2.0.1.0升级ORACLE Version 10.2.0.4.0之后,就可以进行恢复操作。

[oracle@chenanzhen-oracle-test2 2017-01-05--02:15:01]$ ls

20170105_archive_75249_1.bak  20170105_archive_75258_1.bak  20170105_archive_75267_1.bak

20170105_archive_75250_1.bak  20170105_archive_75259_1.bak  20170105_archive_75271_1.bak

20170105_archive_75251_1.bak  20170105_archive_75260_1.bak  20170105_archive_75272_1.bak

20170105_archive_75252_1.bak  20170105_archive_75261_1.bak  20170105_archive_75273_1.bak

20170105_archive_75253_1.bak  20170105_archive_75262_1.bak  20170105_Level0_75268_1.bak

20170105_archive_75254_1.bak  20170105_archive_75263_1.bak  20170105_Level0_75269_1.bak

20170105_archive_75255_1.bak  20170105_archive_75264_1.bak  20170105_Level0_75270_1.bak

20170105_archive_75256_1.bak  20170105_archive_75265_1.bak  controlfile.log

20170105_archive_75257_1.bak  20170105_archive_75266_1.bak  controlfile_spfile

[oracle@chenanzhen-oracle-test2 2017-01-05--02:15:01]$ cd controlfile_spfile/

[oracle@chenanzhen-oracle-test2 controlfile_spfile]$ ls

controlfile_RACDB_75276_1_932444119.bak  spfile_RACDB_75275_1_932444116.bak

启动数据库到nomount状态,恢复spfile文件,pfile文件,控制文件

[oracle@chenanzhen-oracle-test2 dbs]$vi inintracdb.ora

*.control_files='/data/oracle/oradata/BOLO1021/control01.ctl','/data/oracle/oradata/BOLO1021/control02.ctl','/data/oracle/oradata/BOLO1021/control03.ctl'

*.core_dump_dest='/opt/oracle/app/oracle/admin/racdb/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='racdb'

[oracle@chenanzhen-oracle-test2 controlfile_spfile]$sqlplus / as sysdba;

sql>startup nomount pfile='/opt/oracle/app/oracle/product/10.2/db_1/dbs/inintracdb.ora';

数据库在nomount状态下,可以恢复spfile文件

#恢复 spfile文件

sql>resote spfile from '/data/2017-01-05--02:15:01/controlfile_spfile/spfile_RACDB_75275_1_932444116.bak';

sql>shutdown immediate;

[oracle@chenanzhen-oracle-test2 controlfile_spfile]$ cd $ORACLE_HOME/dbs

[oracle@chenanzhen-oracle-test2 dbs]$ ls

hc_racdb.dat  initdw.ora  init.ora  initracdb.ora  lkRACDB  orapwracdb  spfileracdb.ora

[oracle@chenanzhen-oracle-test2 dbs]$rm  initracdb.ora

#恢复pfile文件

[oracle@chenanzhen-oracle-test2 controlfile_spfile]$sqlplus / as sysdba;

sql>create pfile from spfile;

sql>shutdown immediate;

#更改pfile文件 initracdb.ora。删除一些不要的参数,比如关于rac方面的等等,更改控制文件路径*.control_files为自己设置要存放的路径,更改版本*.compatible为升

级之后的版本。

[oracle@chenanzhen-oracle-test2 dbs]$ cat initracdb.ora

*.audit_file_dest='/opt/oracle/app/oracle/admin/racdb/adump'

*.background_dump_dest='/opt/oracle/app/oracle/admin/racdb/bdump'

*.compatible='10.2.0.4.0'

*.control_files='/data/oracle/oradata/BOLO1021/control01.ctl','/data/oracle/oradata/BOLO1021/control02.ctl','/data/oracle/oradata/BOLO1021/control03.ctl'

*.core_dump_dest='/opt/oracle/app/oracle/admin/racdb/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='racdb'

*.db_recovery_file_dest='/opt/oracle/app/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=2147483648

*.dispatchers='(PROTOCOL=TCP) (SERVICE=racdbXDB)'

*.job_queue_processes=10

*.open_cursors=300

*.pga_aggregate_target=185597952

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=557842432

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/opt/oracle/app/oracle/admin/racdb/udump'

创建pfile文件 initracdb.ora文件里面需要的目录

[oracle@chenanzhen-oracle-test2 dbs]$ mkdir  -p  /opt/oracle/app/oracle/admin/racdb/adump

[oracle@chenanzhen-oracle-test2 dbs]$ mkdir  -p  /opt/oracle/app/oracle/admin/racdb/bdump

[oracle@chenanzhen-oracle-test2 dbs]$ mkdir  -p  /opt/oracle/app/oracle/admin/racdb/cdump

[oracle@chenanzhen-oracle-test2 dbs]$ mkdir  -p  /opt/oracle/app/oracle/admin/racdb/udump

[oracle@chenanzhen-oracle-test2 dbs]$ mkdir  -p  /opt/oracle/app/oracle/flash_recovery_area

保存更改

创建所需要的 spfile文件

[oracle@chenanzhen-oracle-test2 controlfile_spfile]$sqlplus / as sysdba;

sql>create spfile from pfile;

sql>shutdown immediate

#启动数据库到mount状态,可以进行恢复数据操作

[oracle@chenanzhen-oracle-test2 controlfile_spfile]$sqlplus / as sysdba;

sql>startup mount;

#在控制文件中,注册备份集,并修改数据文件的名称。

RMAN> catalog start with '/data/2017-01-05--02:15:01/';

报错:

ORA-00600: internal error code, arguments: [kgeade_is_0], [], [], [], [], [], [], []

原因:是在RAC ASM文件系统恢复到单机文件系统,需要打补丁。不然会报错,内部错误。

[oracle@chenanzhen-oracle-test2 controlfile_spfile]$sqlplus / as sysdba;

RMAN>

run

{

  set newname for datafile 1 to '/data/oracle/oradata/BOLO1021/system.346.932225401';

  set newname for datafile 2 to '/data/oracle/oradata/BOLO1021/undotbs1.374.932221775';

  set newname for datafile 3 to '/data/oracle/oradata/BOLO1021/sysaux.322.932228761';

  set newname for datafile 4 to '/data/oracle/oradata/BOLO1021/users.305.932228575';

  set newname for datafile 5 to '/data/oracle/oradata/BOLO1021/undotbs2.301.932224429';

  set newname for datafile 6 to '/data/oracle/oradata/BOLO1021/indx_data01.dbf';

  set newname for datafile 7 to '/data/oracle/oradata/BOLO1021/lobx_data01.dbf';

  set newname for datafile 8 to '/data/oracle/oradata/BOLO1021/addmoney_data01.dbf';

  set newname for datafile 9 to '/data/oracle/oradata/BOLO1021/assign_data01.dbf';

  省略一些数据文件。。。。。。

  

  allocate channel c1 device type disk;

  allocate channel c2 device type disk;

  allocate channel c3 device type disk;

  restore database;   

  switch datafile all;

  switch tempfile all;

  release channel c1;

  release channel c2;

  release channel c3;

}

报错:

ORA-00600: internal error code, arguments: [kgeade_is_0], [], [], [], [], [], [], []

原因:是在RAC ASM文件系统恢复到单机文件系统,需要打补丁。不然会报错,内部错误。

即通过2种方法来实现:

1.打补丁,或者升级。

        1.shutdown database

        2.unzip  p7207932_10204_Linux-x86-64.zip

        3.cd 7207932

        4.$ORACLE_HOME/OPatch/opatch apply

2.重建控制文件,更新里面的路径。

        1.alter database backup controlfile to trace as '/u01/controlfile.log'

        2.recreate controlfile (更新里面redo的路径)

备注:

于是抛出600错误,经过查看MOS,确定遇到了ORACLE的BUG(BUG:7207932 – ORA-600 [KGEADE_IS_0] WHEN RENAMING A FILE FROM ASM TO FS?

 A possible workaround is to recreate the controlfile and specifying new filenames in the controlfile. If this does not work, 

then apply the patch for Bug:7207932.)。这个BUG已经在7207932补丁修复。那就安装7207932补丁尝试解决。

我们采用第一种方法实现:下载补丁p7207932_10204_Linux-x86-64.zip

[oracle@b2-jjywfkdb ~]$ ls

p7207932_10204_Linux-x86-64.zip  script

[oracle@b2-jjywfkdb ~]$ unzip p7207932_10204_Linux-x86-64.zip

[oracle@b2-jjywfkdb ~]$ cd 7207932/

[oracle@chenanzhen-oracle-test2 7207932]$echo $ORACLE_HOME

/oracle/product/10.2.0/db_1/

#安装补丁

[oracle@chenanzhen-oracle-test2 7207932]$/oracle/product/10.2.0/db_1/OPatch/opatch apply

y

#安装完补丁后,验证补丁是否成功安装。

[oracle@chenanzhen-oracle-test2 7207932]$/oracle/product/10.2.0/db_1/OPatch/opatch lsinventory

确认已经成功安装补丁后。可以进行恢复操作了。

进入rman。数据库需要在mount状态下,才可以进行恢复操作。

[oracle@chenanzhen-oracle-test2 7207932]$sqlplus  / as sysdba

[oracle@chenanzhen-oracle-test2 7207932]$shutdown immediate;

[oracle@chenanzhen-oracle-test2 7207932]$startup mount;

[oracle@chenanzhen-oracle-test2 7207932]$ rman target /

#在控制文件中,注册备份集,并修改数据文件的名称。

RMAN> catalog start with '/data/2017-01-05--02:15:01/';

run

{

  set newname for datafile 1 to '/data/oracle/oradata/BOLO1021/system.346.932225401';

  set newname for datafile 2 to '/data/oracle/oradata/BOLO1021/undotbs1.374.932221775';

  set newname for datafile 3 to '/data/oracle/oradata/BOLO1021/sysaux.322.932228761';

  set newname for datafile 4 to '/data/oracle/oradata/BOLO1021/users.305.932228575';

  set newname for datafile 5 to '/data/oracle/oradata/BOLO1021/undotbs2.301.932224429';

  set newname for datafile 6 to '/data/oracle/oradata/BOLO1021/indx_data01.dbf';

  set newname for datafile 7 to '/data/oracle/oradata/BOLO1021/lobx_data01.dbf';

  set newname for datafile 8 to '/data/oracle/oradata/BOLO1021/addmoney_data01.dbf';

  set newname for datafile 9 to '/data/oracle/oradata/BOLO1021/assign_data01.dbf';

  set newname for datafile 10 to '/data/oracle/oradata/BOLO1021/base_info01.dbf';

  set newname for datafile 11 to '/data/oracle/oradata/BOLO1021/card_data01.dbf';

  set newname for datafile 12 to '/data/oracle/oradata/BOLO1021/diccode_data01.dbf';

  set newname for datafile 13 to '/data/oracle/oradata/BOLO1021/indx_data02.dbf';

  set newname for datafile 14 to '/data/oracle/oradata/BOLO1021/log_data01.dbf';

  set newname for datafile 15 to '/data/oracle/oradata/BOLO1021/order_data01.dbf';

  set newname for datafile 16 to '/data/oracle/oradata/BOLO1021/pass_data01.dbf';

  set newname for datafile 17 to '/data/oracle/oradata/BOLO1021/user_data01';

  set newname for datafile 18 to '/data/oracle/oradata/BOLO1021/account_kz01.dbf';

  set newname for datafile 19 to '/data/oracle/oradata/BOLO1021/account_td01.dbf';

  set newname for datafile 20 to '/data/oracle/oradata/BOLO1021/account_lj01.dbf';

  set newname for datafile 21 to '/data/oracle/oradata/BOLO1021/account_zg01.dbf';

  set newname for datafile 22 to '/data/oracle/oradata/BOLO1021/account_qq01.dbf';

  set newname for datafile 23 to '/data/oracle/oradata/BOLO1021/account_sg01.dbf';

  set newname for datafile 24 to '/data/oracle/oradata/BOLO1021/account_kz02.dbf';

  set newname for datafile 25 to '/data/oracle/oradata/BOLO1021/account_td02.dbf';

  set newname for datafile 26 to '/data/oracle/oradata/BOLO1021/account_lj02.dbf';

  set newname for datafile 27 to '/data/oracle/oradata/BOLO1021/account_zg02.dbf';

  set newname for datafile 28 to '/data/oracle/oradata/BOLO1021/account_qq02.dbf';

  set newname for datafile 29 to '/data/oracle/oradata/BOLO1021/account_sg02.dbf';

  set newname for datafile 30 to '/data/oracle/oradata/BOLO1021/base_info02.dbf';

  set newname for datafile 31 to '/data/oracle/oradata/BOLO1021/base_info03.dbf';

  set newname for datafile 32 to '/data/oracle/oradata/BOLO1021/base_info04.dbf';

  set newname for datafile 33 to '/data/oracle/oradata/BOLO1021/base_info05.dbf';

  set newname for datafile 34 to '/data/oracle/oradata/BOLO1021/base_info06.dbf';

  set newname for datafile 35 to '/data/oracle/oradata/BOLO1021/base_info07.dbf';

  set newname for datafile 36 to '/data/oracle/oradata/BOLO1021/base_info08.dbf';

  set newname for datafile 37 to '/data/oracle/oradata/BOLO1021/card_data02.dbf';

  set newname for datafile 38 to '/data/oracle/oradata/BOLO1021/card_data04.dbf';

  set newname for datafile 39 to '/data/oracle/oradata/BOLO1021/card_data03.dbf';

  set newname for datafile 40 to '/data/oracle/oradata/BOLO1021/card_data05.dbf';

  set newname for datafile 41 to '/data/oracle/oradata/BOLO1021/account_kz04.dbf';

  set newname for datafile 42 to '/data/oracle/oradata/BOLO1021/indx_data03.dbf';

  set newname for datafile 43 to '/data/oracle/oradata/BOLO1021/account_kz05.dbf';

  set newname for datafile 44 to '/data/oracle/oradata/BOLO1021/order_data02.dbf';

  set newname for datafile 45 to '/data/oracle/oradata/BOLO1021/order_data03.dbf';

  set newname for datafile 46 to '/data/oracle/oradata/BOLO1021/order_data04.dbf';

  set newname for datafile 47 to '/data/oracle/oradata/BOLO1021/pass_data02.dbf';

  set newname for datafile 48 to '/data/oracle/oradata/BOLO1021/pass_data03.dbf';

  set newname for datafile 49 to '/data/oracle/oradata/BOLO1021/pass_data04.dbf';

  set newname for datafile 50 to '/data/oracle/oradata/BOLO1021/pass_data05.dbf';

  set newname for datafile 51 to '/data/oracle/oradata/BOLO1021/indx_data04.dbf';

  set newname for datafile 52 to '/data/oracle/oradata/BOLO1021/sh001.dbf';

  set newname for datafile 53 to '/data/oracle/oradata/BOLO1021/account_kz06.dbf';

  set newname for datafile 54 to '/data/oracle/oradata/BOLO1021/indx_data05.dbf';

  set newname for datafile 55 to '/data/oracle/oradata/BOLO1021/history_data01.dbf';

  set newname for datafile 56 to '/data/oracle/oradata/BOLO1021/history_data02.dbf';

  set newname for datafile 57 to '/data/oracle/oradata/BOLO1021/history_data03.dbf';

  set newname for datafile 58 to '/data/oracle/oradata/BOLO1021/history_data04.dbf';

  set newname for datafile 59 to '/data/oracle/oradata/BOLO1021/history_data05.dbf';

  set newname for datafile 60 to '/data/oracle/oradata/BOLO1021/history_data06.dbf';

  set newname for datafile 61 to '/data/oracle/oradata/BOLO1021/history_data07.dbf';

  set newname for datafile 62 to '/data/oracle/oradata/BOLO1021/account_kz07.dbf';

  set newname for datafile 63 to '/data/oracle/oradata/BOLO1021/account_lj03.dbf';

  set newname for datafile 64 to '/data/oracle/oradata/BOLO1021/account_kz08.dbf';

  set newname for datafile 65 to '/data/oracle/oradata/BOLO1021/account_lj04.dbf';

  set newname for datafile 66 to '/data/oracle/oradata/BOLO1021/indx_data06.dbf';

  set newname for datafile 67 to '/data/oracle/oradata/BOLO1021/base_info09.dbf';

  set newname for datafile 68 to '/data/oracle/oradata/BOLO1021/base_info10.dbf';

  set newname for datafile 69 to '/data/oracle/oradata/BOLO1021/account_zsg01.dbf';

  set newname for datafile 70 to '/data/oracle/oradata/BOLO1021/account_zsg02.dbf';

  

  set newname for datafile 71 to '/data/oracle/oradata/BOLO1021/account_kw01.dbf';

  set newname for datafile 72 to '/data/oracle/oradata/BOLO1021/account_kw02.dbf';

  set newname for datafile 73 to '/data/oracle/oradata/BOLO1021/account_dy01.dbf';

  set newname for datafile 74 to '/data/oracle/oradata/BOLO1021/undotbs1.356.932221815';

  set newname for datafile 75 to '/data/oracle/oradata/BOLO1021/undotbs2.353.932221819';

  set newname for datafile 76 to '/data/oracle/oradata/BOLO1021/racaudit.372.932221775';

  set newname for datafile 77 to '/data/oracle/oradata/BOLO1021/spc_his01.dbf';

  set newname for datafile 78 to '/data/oracle/oradata/BOLO1021/cms_kf01.dbf';

  set newname for datafile 79 to '/data/oracle/oradata/BOLO1021/account_kz09.dbf';

  set newname for datafile 80 to '/data/oracle/oradata/BOLO1021/account_kw03.dbf';

  set newname for datafile 81 to '/data/oracle/oradata/BOLO1021/base_info11.dbf';

  set newname for datafile 82 to '/data/oracle/oradata/BOLO1021/base_info12.dbf';

  set newname for datafile 83 to '/data/oracle/oradata/BOLO1021/user_data02.dbf';

  set newname for datafile 84 to '/data/oracle/oradata/BOLO1021/pass_data06.dbf';

  set newname for datafile 85 to '/data/oracle/oradata/BOLO1021/indx_data07.dbf';

  set newname for datafile 86 to '/data/oracle/oradata/BOLO1021/base_info13.dbf';

  set newname for datafile 87 to '/data/oracle/oradata/BOLO1021/account_kz10.dbf';

  set newname for datafile 88 to '/data/oracle/oradata/BOLO1021/base_info14.dbf';

  set newname for datafile 89 to '/data/oracle/oradata/BOLO1021/account_kw04.dbf';

  set newname for datafile 90 to '/data/oracle/oradata/BOLO1021/account_kz11.dbf';

  

  allocate channel c1 device type disk;

  allocate channel c2 device type disk;

  allocate channel c3 device type disk;

  restore database;   

  switch datafile all;

  switch tempfile all;

  release channel c1;

  release channel c2;

  release channel c3;

}

因为Oracle10G不支持set newname for database所有要set newname for datafile一个一个文件改目录set newname for database to '/data/oracle/oradata/BOLO1021/

%b';。

[oracle@chenanzhen-oracle-test2 ~]$ sqlplus / as sysdba

SQL>

alter database rename file '+DATA/bolo102/onlinelog/group_10.273.885180819' to '/data/oradata/bolo102/onlinelog/group_10.273.885180819';

alter database rename file '+DATA/bolo102/onlinelog/group_9.274.885180803' to '/data/oradata/bolo102/onlinelog/group_9.274.885180803';

alter database rename file '+DATA/bolo102/onlinelog/group_7.276.885180773' to '/data/oradata/bolo102/onlinelog/group_7.276.885180773';

alter database rename file '+DATA/bolo102/onlinelog/group_8.275.885180787' to '/data/oradata/bolo102/onlinelog/group_8.275.885180787';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo50.log' to '/data/oradata/bolo102/onlinelog/stdredo50.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo51.log' to '/data/oradata/bolo102/onlinelog/stdredo51.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo52.log' to '/data/oradata/bolo102/onlinelog/stdredo52.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo53.log' to '/data/oradata/bolo102/onlinelog/stdredo53.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo54.log' to '/data/oradata/bolo102/onlinelog/stdredo54.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo55.log' to '/data/oradata/bolo102/onlinelog/stdredo55.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo56.log' to '/data/oradata/bolo102/onlinelog/stdredo56.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo57.log' to '/data/oradata/bolo102/onlinelog/stdredo57.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo58.log' to '/data/oradata/bolo102/onlinelog/stdredo58.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo59.log' to '/data/oradata/bolo102/onlinelog/stdredo59.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo60.log' to '/data/oradata/bolo102/onlinelog/stdredo60.log';

alter database rename file '+ARCH/bolo102/onlinelog/stdredo61.log' to '/data/oradata/bolo102/onlinelog/stdredo61.log';

alter database rename file '+DATA/bolo102/onlinelog/group_1.282.885180595' to '/data/oradata/bolo102/onlinelog/group_1.282.885180595';

alter database rename file '+DATA/bolo102/onlinelog/group_2.281.885180625' to '/data/oradata/bolo102/onlinelog/group_2.281.885180625';

alter database rename file '+DATA/bolo102/onlinelog/group_3.280.885180655' to '/data/oradata/bolo102/onlinelog/group_3.280.885180655';

alter database rename file '+DATA/bolo102/onlinelog/group_4.279.885180685' to '/data/oradata/bolo102/onlinelog/group_4.279.885180685';

alter database rename file '+DATA/bolo102/onlinelog/group_5.278.885180713' to '/data/oradata/bolo102/onlinelog/group_5.278.885180713';

alter database rename file '+DATA/bolo102/onlinelog/group_6.277.885180743' to '/data/oradata/bolo102/onlinelog/group_6.277.885180743';

alter database rename file '+DATA/bolo102/onlinelog/group_21.268.885180895' to '/data/oradata/bolo102/onlinelog/group_21.268.885180895';

alter database rename file '+DATA/bolo102/onlinelog/group_22.267.885180925' to '/data/oradata/bolo102/onlinelog/group_22.267.885180925';

alter database rename file '+DATA/bolo102/onlinelog/group_23.266.885180957' to '/data/oradata/bolo102/onlinelog/group_23.266.885180957';

alter database rename file '+DATA/bolo102/onlinelog/group_24.265.885180985' to '/data/oradata/bolo102/onlinelog/group_24.265.885180985';

alter database rename file '+DATA/bolo102/onlinelog/group_25.264.885181015' to '/data/oradata/bolo102/onlinelog/group_25.264.885181015';

alter database rename file '+DATA/bolo102/onlinelog/group_26.263.885181045' to '/data/oradata/bolo102/onlinelog/group_26.263.885181045';

alter database rename file '+ARCH/bolo102/onlinelog/group_1.1231.885180609' to '/data/oradata/bolo102/onlinelog/group_1.1231.885180609';

alter database rename file '+ARCH/bolo102/onlinelog/group_2.437.885180641' to '/data/oradata/bolo102/onlinelog/group_2.437.885180641';

alter database rename file '+ARCH/bolo102/onlinelog/group_3.1223.885180669' to '/data/oradata/bolo102/onlinelog/group_3.1223.885180669';

alter database rename file '+ARCH/bolo102/onlinelog/group_4.286.885180699' to '/data/oradata/bolo102/onlinelog/group_4.286.885180699';

alter database rename file '+ARCH/bolo102/onlinelog/group_5.288.885180729' to '/data/oradata/bolo102/onlinelog/group_5.288.885180729';

alter database rename file '+ARCH/bolo102/onlinelog/group_6.1233.885180757' to '/data/oradata/bolo102/onlinelog/group_6.1233.885180757';

alter database rename file '+ARCH/bolo102/onlinelog/group_7.1226.885180779' to '/data/oradata/bolo102/onlinelog/group_7.1226.885180779';

alter database rename file '+ARCH/bolo102/onlinelog/group_8.284.885180795' to '/data/oradata/bolo102/onlinelog/group_8.284.885180795';

alter database rename file '+ARCH/bolo102/onlinelog/group_9.1225.885180811' to '/data/oradata/bolo102/onlinelog/group_9.1225.885180811';

alter database rename file '+ARCH/bolo102/onlinelog/group_10.1282.885180827' to '/data/oradata/bolo102/onlinelog/group_10.1282.885180827';

alter database rename file '+DATA/bolo102/onlinelog/group_11.272.885180833' to '/data/oradata/bolo102/onlinelog/group_11.272.885180833';

alter database rename file '+DATA/bolo102/onlinelog/group_12.271.885180849' to '/data/oradata/bolo102/onlinelog/group_12.271.885180849';

alter database rename file '+DATA/bolo102/onlinelog/group_13.270.885180865' to '/data/oradata/bolo102/onlinelog/group_13.270.885180865';

alter database rename file '+DATA/bolo102/onlinelog/group_14.269.885180881' to '/data/oradata/bolo102/onlinelog/group_14.269.885180881';

alter database rename file '+ARCH/bolo102/onlinelog/group_21.1219.885180911' to '/data/oradata/bolo102/onlinelog/group_21.1219.885180911';

alter database rename file '+ARCH/bolo102/onlinelog/group_22.1294.885180941' to '/data/oradata/bolo102/onlinelog/group_22.1294.885180941';

alter database rename file '+ARCH/bolo102/onlinelog/group_11.1291.885180841' to '/data/oradata/bolo102/onlinelog/group_11.1291.885180841';

alter database rename file '+ARCH/bolo102/onlinelog/group_23.1222.885180971' to '/data/oradata/bolo102/onlinelog/group_23.1222.885180971';

alter database rename file '+ARCH/bolo102/onlinelog/group_24.1202.885181001' to '/data/oradata/bolo102/onlinelog/group_24.1202.885181001';

alter database rename file '+ARCH/bolo102/onlinelog/group_12.1236.885180857' to '/data/oradata/bolo102/onlinelog/group_12.1236.885180857';

alter database rename file '+ARCH/bolo102/onlinelog/group_13.296.885180873' to '/data/oradata/bolo102/onlinelog/group_13.296.885180873';

alter database rename file '+ARCH/bolo102/onlinelog/group_25.1217.885181029' to '/data/oradata/bolo102/onlinelog/group_25.1217.885181029';

alter database rename file '+ARCH/bolo102/onlinelog/group_26.1208.885181059' to '/data/oradata/bolo102/onlinelog/group_26.1208.885181059';

alter database rename file '+ARCH/bolo102/onlinelog/group_14.1229.885180889' to '/data/oradata/bolo102/onlinelog/group_14.1229.885180889';

alter database rename file '+DATA/bolo102/onlinelog/group_35.262.885181075' to '/data/oradata/bolo102/onlinelog/group_35.262.885181075';

alter database rename file '+DATA/bolo102/onlinelog/group_36.261.885181091' to '/data/oradata/bolo102/onlinelog/group_36.261.885181091';

alter database rename file '+ARCH/bolo102/onlinelog/group_36.1201.885181099' to '/data/oradata/bolo102/onlinelog/group_36.1201.885181099';

alter database rename file '+DATA/bolo102/onlinelog/group_37.260.885181107' to '/data/oradata/bolo102/onlinelog/group_37.260.885181107';

alter database rename file '+ARCH/bolo102/onlinelog/group_37.1265.885181115' to '/data/oradata/bolo102/onlinelog/group_37.1265.885181115';

alter database rename file '+DATA/bolo102/onlinelog/group_38.259.885181123' to '/data/oradata/bolo102/onlinelog/group_38.259.885181123';

alter database rename file '+ARCH/bolo102/onlinelog/group_38.1196.885181131' to '/data/oradata/bolo102/onlinelog/group_38.1196.885181131';

alter database rename file '+ARCH/bolo102/onlinelog/group_35.1266.885181083' to '/data/oradata/bolo102/onlinelog/group_35.1266.885181083';

进入sqlplus中。

[oracle@chenanzhen-oracle-test2 ~]$ sqlplus / as sysdba

查看rodo日志文件是否更改

SQL> select MEMBER from v$LOGFILE;

#恢复数据库

[oracle@chenanzhen-oracle-test2 ~]$ rman  target /

RMAN> recover database;

Starting recover at 17-JAN-17

using channel ORA_DISK_1

starting media recovery

archive log thread 1 sequence 39366 is already on disk as file 

/opt/oracle/app/oracle/flash_recovery_area/RACDB/archivelog/2017_01_17/o1_mf_1_39366_d7t0ng5l_.arc

unable to find archive log

archive log thread=2 sequence=39078

RMAN-00571: ===========================================================

RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571: ===========================================================

RMAN-03002: failure of recover command at 01/17/2017 01:51:49

RMAN-06054: media recovery requesting unknown log: thread 2 seq 39078 lowscn 28816324483

这个错误是在recover的过程中报错的,也就是说前面的恢复过程很正常。从报错信息也可以看出是因为找不到归档日志,seq也已经给出。为什么找不到呢?原因是这样的:

当我们在recover的时候,rman会自动恢复到控制文件中记录的scn。在异机进行恢复时,只拷贝了备份文件,而源库的联机日志文件并没有拷贝或者说缺少源库联机日志的数

据信息。明白了这一点,报错的原因就很清楚了。

    如何解决呢?方法只有一个,将那个时间的日志拷贝过来,进行恢复就可以了。如何拷贝呢?关闭源库后才能拷贝,这个。。。

--注:此处报错属于正常现象,因为前面创建的备份非一致性备份

[oracle@chenanzhen-oracle-test2 ~]$ sqlplus / as sysdba

SQL>  alter database open resetlogs;  #恢复redo文件,重置
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐