一、准备环境
oracle版本 :10.2.0.1
系统版本:centos6.8
1、修改主机名
[root@crmdbpri ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=crmdbpri
2、修改系统版本【oracle10.2.0.1最高支持红帽4】
[root@crmdbpri ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 4 (Tikanga)
3、修改系统参数
[root@crmdbpri ~]# cat /etc/sysctl.conf
#define
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
[root@crmdbpri ~]# cat /etc/security/limits.conf
#define
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
[root@crmdbpri ~]# cat /etc/pam.d/login
#define
session required /lib64/security/pam_limits.so
二、Oracle安装
切换到Oracle用户解压安装包
10201_database_linux_x86_64.cpio
解压cpio文件 cpio -idmv < filename.cpio
同样可以解压img文件:cpio -idmv < filename.imgcpio
备份命令备份:cpio -covB > [file|device]
将数据备份到文件或设备上还原:cpio -icduv < [file|device}
将数据还原到系统中常用参数:-o :将数据copy到文件或设备上
-i :将数据从文件或设备上还原到系统中
-t :查看cpio建立的文件或设备内容
-c :一种比较新的portable format方式存储
-v :在屏幕上显示备份过程中的文件名
-B :让预设的blocks可以增加到5120bytes,默认是512bytes,这样可以使备份速度加快
-d :自动建立目录,这样还原时才不会出现找不到路径的问题
-u :更新,用较新的文件覆盖旧的文件cpio常与find 配合使用
进入解压文件database中运行./runInstaller
出现图形界面之后,可以根据自己的需要操作【这里不需要建库】,选择自己的安装路径和主机名即可
三、数据恢复
[oracle@crmdbpri ~]$ rman target /
1、在原数据库上查看当时的rman日志,查看当时的dbid值
RMAN> set dbid 1342167760
RMAN> startup nomount
2、恢复spfile文件
RMAN> list backup of spfile;源库查看参数文件
restore spfile to '/u01/oracle/10/dbs/initcrmdbpri.ora' from '/u01/rman/o1_mf_s_1020121275_grw91wvs_.bkp';
3、强制挂载
RMAN> startup force nomount
4、恢复控制文件
restore controlfile to 'u01/oradata/datafile/control01.ctl' from '/u01/rman/ctl_CRMDBPRI_20191004_8182_1';
5、挂载数据库
RMAN> alter database mount;
6、指定数据备份和归档备份
RMAN> catalog start with '/u01/rman';
7、 查看源库的数据文件和redo日志文件位置,更新对应的存储位置
源库执行以下语句查看对应的位置
select 'set newname for datafile ' || a.FILE# || ' to "' || a.NAME || '";'
from v$datafile a
union all
select 'set newname for tem