`
aroundworld2008
  • 浏览: 47508 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

转 RH4 oracle rman

阅读更多

Red Hat Enterprise Linux AS release 4 (Nahant Update 2)下ORACLE9.2的安装

[原创 2006-12-14 21:27:26 ] 发表者: westzq
#####################smb共享#######################
创建组    groupadd -g 601 dba
创建用户  useradd -u 801 -g dba -G dba oracle

vi /etc/samba/smb.conf

###
 path=/home/oracle/pub
 vailduser=oracle
 public=Yes
 writable=Yes
 comment="......."
###

测试 testparm

smbpasswd -a oracle

service smb restart

关闭防火墙 setup

######################解压##########################
gunzip

cpio -idmv <

######################远程桌面######################
ssh root@192.168.123.95

######################资源包安装######################
rpm -ivh/uvh

#####################共享#########################
vi /etc/exports
共享文件夹    对象主机(ro)
启动服务 portmap   nfs

对象机上启动 portmap

mount -t nfs 192.168.123.91:/home/oracle/pub /mnt

####################环境设置#####################

# grep MemTotal /proc/meminfo    --查看内存总量

# /sbin/swapon --硬盘

# vi /etc/hosts   --配置网络地址

# vi /etc/sysconfig/network  --查看是否正确

# service network restart

# vi /etc/sysctl.conf
###bgn
 kernel.sysrq=1
 kernel.msgmni=1024
 kernel.shmmax=2147483648
 kernel.shmmni=4906
 kernel.shmall=2097152
 kernel.sem=1024 64000 200 512
 fs.file-max=65536
 net.ipv4.ip_local_port_range=1024 65000
 net.ipv4.tcp_sack=0
 net.ipv4.tcp_timestamps=0
 net.ipv4.tcp_max_syn_backlog=8192
 net.ipv4.tcp_keepalive_time=120
 net.core.rmem_default=262144
 net.core.rmem_max=262144
 net.core.wmem_default=262144
 net.core.wmem_max=262144
###end

# /sbin/sysctl -p

# su - oracle

$ vi  .bash_profile
###bgn
 export LD_ASSUME_KERNEL=2.4.1
 export LC_CTYPE=en_US.UTF-8
 export ORACLE_SID=PROD             
 export ORACLE_BASE=/oraapp/oracle
 export ORACLE_HOME=/oraapp/oracle/92
 export TNS_ADMIN=$ORACLE_HOME/network/admin
 export ORA_DB=$ORACLE_HOME/dbs
 export ORACLE_BDUMP=$ORACLE_BASE/shtkt/bdump
 export ORACLE_TERM=xterm
 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
 export ORA_NLS33=$ORACLE_HOME/ocommon/nls/admin/data
 export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib:/usr/local/lib
 export LIBPATH=$ORACLE_HOME/lib:$ORACLE_HOME/ctx/lib
 export CLASSPATH=$ORACLE_HOME/JRE/lib:$ORACLE_HOME/JRE/lib/rt.jar:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
 PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
 export PATH
 umask 022
###end

$ source .bash_profile   --让新的环境变量生效
-----root下
# vi /etc/security/limits.conf
###bgn
*   soft    nproc   2047
*   hard    nproc   16384
*   soft    nofile  1024
*   hard    nofile  65536
###end

# vi /etc/pam.d/login
###bgn
session   required  /lib/security/pam_limits.so
###end

# vi /etc/profile
###bgn
if [ $USER = "oracle" ]; then 
   if [ $SHELL = "/bin/ksh" ]; then 
      ulimit -p 16384 
      ulimit -n 65536 
   else 
      ulimit -u 16384 -n 65536 
   fi 
fi
###end

$ ulimit

(Red Hat Enterprise Linux AS release 4 (Nahant Update 2))
# mv /usr/bin/gcc /usr/bin/gcc34
# ln -s /usr/bin/gcc32 /usr/bin/gcc
# mv /usr/bin/g++ /usr/bin/g++34
# ln -s /usr/bin/g++32 /usr/bin/g++


# reboot

######################linux安装#####################
安装
1.enter
2.skip 回车
3.next
4.语言english next
5.manually partition with disk druid
  /boot   ext3   100M    fixed size
          swap   物理内存2倍
  /       ext3           fixed size
6.enable firewall / remote login(SSH)
7.customize software packages to be installed
  development下全部包

#######################oracle安装###################

# xhost +

su - oracle

解压在ORACLE下

盘一 ./runInstaller

一般会出错,需要安装资源包
compat-oracle-rhel4-1.0-5.i386.rpm
compat-libcwait-2.1-1.i386.rpm
libaio-devel-0.3.103-3.i386.rpm

#############查看监听是否正常#####################

tnsping prod

###############PROD脚本##########################
init.ora

 ### 内存配置
 DB_BLOCK_SIZE=8192
 LOG_BUFFER=3145728
 SORT_AREA_SIZE=524288
 SGA_MAX_SIZE=130M
 DB_CACHE_SIZE=32M
 JAVA_POOL_SIZE=0M
 LARGE_POOL_SIZE=24M
 SHARED_POOL_SIZE=24M
 PGA_AGGREGATE_TARGET=24M
 ###
 ### $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 ### 归档服务器配置
 LOG_ARCHIVE_DEST_1=('LOCATION=/oradata/prod/arch') MANDATORY REOPEN
 LOG_ARCHIVE_FORMAT='%t_%s.arc'
 LOG_ARCHIVE_START=TRUE
 # DISPATCHERS='(PROTOCOL=TCP)(DISPATCHERS=1)'
 # SHARED_SERVERS=1
 # MAX_DISPATCHERS=5
 # MAX_SHARED_SERVERS=8
 ###
 ### $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 ### 路径配置
 UTL_FILE_DIR='/oradata/prod/logmnr'
 BACKGROUND_DUMP_DEST='/oradata/prod/dump/bdump'
 CORE_DUMP_DEST='/oradata/prod/dump/cdump'
 USER_DUMP_DEST='/oradata/prod/dump/udump'
 CONTROL_FILES=('/oradata/prod/data/PROD_control01','/oradata/prod/data/PROD_control02','/oradata/prod/data/PROD_control03')
 DB_DOMAIN='PKIBM.COM'
 DB_NAME='PROD'
 INSTANCE_NAME='PROD'
 UNDO_MANAGEMENT=AUTO
 UNDO_RETENTION=7200
 UNDO_TABLESPACE='UNDOTBS'
 ###
 ### $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 ### 其它参数
 DB_FILE_MULTIBLOCK_READ_COUNT=16
 OPEN_CURSORS=100
 OPTIMIZER_MODE=CHOOSE
 CURSOR_SHARING=SIMILAR
 TIMED_STATISTICS=TRUE
 COMPATIBLE=9.2.0.0.0
 HASH_JOIN_ENABLED=TRUE
 STAR_TRANSFORMATION_ENABLED=FALSE
 QUERY_REWRITE_ENABLED=TRUE
 QUERY_REWRITE_INTEGRITY=TRUSTED
 PROCESSES=200
 FAST_START_MTTR_TARGET=300
 REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
 DML_LOCKS=2048
 O7_DICTIONARY_ACCESSIBILITY=FALSE
 WORKAREA_SIZE_POLICY=AUTO
 JOB_QUEUE_PROCESSES=2
 REPLICATION_DEPENDENCY_TRACKING=TRUE
 OPEN_LINKS=2
 GLOBAL_NAMES=FALSE
 AQ_TM_PROCESSES=1


createDB.sh

 #REM  创建必要的目录
 mkdir -p /oradata/prod/dump/bdump
 mkdir -p /oradata/prod/dump/cdump
 mkdir -p /oradata/prod/dump/udump
 mkdir -p /oradata/prod/dump/create
 mkdir -p /oradata/prod/data
 mkdir -p /oradata/prod/arch
 mkdir -p /oradata/prod/bkup
 mkdir -p /oradata/prod/logmnr
 #REM
 #REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 #REM  设置临时环境变量
 export ORACLE_SID=PROD
 #REM
 #REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 #REM  启动Oracle后台服务
 #D:\oracle\ora92\bin\oradim -delete -sid PROD
 #D:\oracle\ora92\bin\oradim  -new  -sid PROD -startmode m   -pfile  D:\oradata\prod\dump\create\init.ora
 #D:\oracle\ora92\bin\oradim  -edit  -sid PROD -startmode a
 #REM
 #REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 #REM  创建密码文件
 rm /oraapp/oracle/92/dbs/orapwPROD
 /oraapp/oracle/92/bin/orapwd file=/oraapp/oracle/92/dbs/orapwPROD password=PKIBM entries=5
 #REM
 #REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 #REM  开始创建数据库
 /oraapp/oracle/92/bin/sqlplus /nolog @/oradata/prod/dump/create/createDB.sql
 #REM
 #REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 #REM  配置数据库网络
 cp /oradata/prod/dump/create/listener.ora  /oraapp/oracle/92/network/admin
 cp /oradata/prod/dump/create/tnsnames.ora  /oraapp/oracle/92/network/admin
 cp /oradata/prod/dump/create/sqlnet.ora    /oraapp/oracle/92/network/admin
 #REM
 #REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 #REM  启动监听
 /oraapp/oracle/92/bin/lsnrctl stop
 /oraapp/oracle/92/bin/lsnrctl start
 #REM
 #REM $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 #REM  (end)

createDB.sql

 --- 启动实例
 CONNECT SYS/PKIBM AS SYSDBA
 SET ECHO ON
 SPOOL /oradata/prod/dump/create/createDB.log
 STARTUP NOMOUNT PFILE='/oradata/prod/dump/create/init.ora';
 ---
 --- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 --- 创建数据库
 CREATE DATABASE "PROD"
 LOGFILE GROUP 1 ('/oradata/prod/data/PROD_redo11','/oradata/prod/data/PROD_redo12') SIZE 5M,
  GROUP 2 ('/oradata/prod/data/PROD_redo21','/oradata/prod/data/PROD_redo22') SIZE 5M,
  GROUP 3 ('/oradata/prod/data/PROD_redo31','/oradata/prod/data/PROD_redo32') SIZE 5M 
 MAXINSTANCES 2
 MAXLOGHISTORY 1
 MAXLOGFILES 12
 MAXLOGMEMBERS 3
 MAXDATAFILES 1024
 NOARCHIVELOG
 CHARACTER SET ZHS16GBK
 NATIONAL CHARACTER SET AL16UTF16
 DATAFILE '/oradata/prod/data/PROD_system01' SIZE 300M REUSE
   AUTOEXTEND ON NEXT 50M MAXSIZE 2000M
 UNDO TABLESPACE "UNDOTBS"
   DATAFILE '/oradata/prod/data/PROD_undo01' SIZE 10M REUSE
   AUTOEXTEND ON NEXT 10M MAXSIZE 2000M EXTENT MANAGEMENT LOCAL
 DEFAULT TEMPORARY TABLESPACE "TEMPTBS"
   TEMPFILE '/oradata/prod/data/PROD_temp01' SIZE 10M REUSE
   AUTOEXTEND ON NEXT 5M MAXSIZE 2000M
   EXTENT MANAGEMENT LOCAL UNIFORM SIZE 512K ;
 ---
 --- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 --- 创建数据词典
 SET ECHO OFF
 @/oraapp/oracle/92/rdbms/admin/catalog.sql;
 @/oraapp/oracle/92/rdbms/admin/catproc.sql;
 ---
 --- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 --- 修改密码
 CONNECT SYS/PKIBM AS SYSDBA
 ALTER USER SYS IDENTIFIED BY PKIBM;
 ALTER USER SYSTEM IDENTIFIED BY PKIBM;
 ---
 --- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 --- 创建帮助词典
 connect SYSTEM/PKIBM
 @/oraapp/oracle/92/sqlplus/admin/pupbld.sql;
 connect SYSTEM/PKIBM
 @/oraapp/oracle/92/sqlplus/admin/help/hlpbld.sql helpus.sql;
 ---
 --- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 --- 配置数据库
 CONNECT SYS/PKIBM AS SYSDBA
 SET ECHO ON
 SHUTDOWN IMMEDIATE;
 CONNECT SYS/PKIBM AS SYSDBA
 STARTUP MOUNT PFILE='/oradata/prod/dump/create/init.ora';
 ALTER DATABASE ARCHIVELOG;
 ALTER DATABASE OPEN;
 CREATE SPFILE FROM PFILE='/oradata/prod/dump/create/init.ora';
 SHUTDOWN IMMEDIATE;
 CONNECT SYS/PKIBM AS SYSDBA
 STARTUP
 ---
 --- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 --- 创建表空间
 CREATE TABLESPACE "PKIBM"
 DATAFILE '/oradata/prod/data/PKIBM_pkibm01' SIZE 10M
 AUTOEXTEND ON NEXT 5M MAXSIZE 2000M
 LOGGING
 ONLINE
 PERMANENT
 EXTENT MANAGEMENT LOCAL
 SEGMENT SPACE MANAGEMENT AUTO UNIFORM SIZE 128K;
 ---
 --- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 --- 修改默认存储
 DROP TABLE "OUTLN"."OL$" ;
 CREATE TABLE "OUTLN"."OL$"("OL_NAME" VARCHAR2(30),"SQL_TEXT" LONG,"TEXTLEN" NUMBER,"SIGNATURE" RAW(16),"HASH_VALUE" NUMBER,"HASH_VALUE2" NUMBER,
 "CATEGORY" VARCHAR2(30),"VERSION" VARCHAR2(64),"CREATOR" VARCHAR2(30),"TIMESTAMP" DATE,"FLAGS" NUMBER, "HINTCOUNT" NUMBER, "SPARE1" NUMBER, "SPARE2" VARCHAR2(1000)
 )TABLESPACE "PKIBM" INITRANS 4;
 ALTER TABLE "OUTLN"."OL$HINTS" MOVE TABLESPACE "PKIBM" INITRANS 4;
 ALTER TABLE "OUTLN"."OL$NODES" MOVE TABLESPACE "PKIBM" INITRANS 4;
 ALTER USER "OUTLN"  DEFAULT TABLESPACE "PKIBM" ;
 ALTER USER "OUTLN"  IDENTIFIED BY "LOCKEDBYDBA" ACCOUNT LOCK  ;
 ALTER USER "DBSNMP"  DEFAULT TABLESPACE "PKIBM" ;
 ALTER USER "DBSNMP"  IDENTIFIED BY "LOCKEDBYDBA" ACCOUNT LOCK  ;
 ---
 --- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 --- 创建默认用户
 CREATE USER PKIBM IDENTIFIED BY PKIBM ACCOUNT UNLOCK;
 GRANT CREATE SESSION TO PKIBM;
 ALTER USER PKIBM  DEFAULT TABLESPACE "PKIBM" ;
 ALTER USER PKIBM  ACCOUNT UNLOCK;
 REVOKE UNLIMITED TABLESPACE FROM PKIBM;
 ALTER USER PKIBM QUOTA UNLIMITED ON PKIBM;
 ---
 --- $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
 --- 结束创建
 SPOOL OFF
 DISCONNECT ;
 EXIT ;

listener.ora

 LISTENER =
   (DESCRIPTION_LIST =
     (DESCRIPTION =
       (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1688))
     )
   )

 SID_LIST_LISTENER =
   (SID_LIST =
     (SID_DESC =
       (GLOBAL_DBNAME = PROD.PKIBM.COM)
       (ORACLE_HOME = D:\oracle\ora92)
       (SID_NAME = PROD)
     )
   )

tnsnames.ora

 PKIBM =
   (DESCRIPTION =
     (ADDRESS_LIST =
       (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1688))
     )
     (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SID = PROD.PKIBM.COM)
     )
   )

sqlnet.ora

 SQLNET.AUTHENTICATION_SERVICES= (NTS)
 NAMES.DIRECTORY_PATH= (TNSNAMES)
 USE_DEDICATED_SERVER = on

#############################RCAT建立#######################################
RCATinit.ora

 DB_BLOCK_SIZE=8192
 LOG_BUFFER=3145728
 SORT_AREA_SIZE=524288
 SGA_MAX_SIZE=268435456
 DB_CACHE_SIZE=167772160
 JAVA_POOL_SIZE=0
 LARGE_POOL_SIZE=25165824
 SHARED_POOL_SIZE=50331648
 PGA_AGGREGATE_TARGET=67108864
 LOG_ARCHIVE_DEST_1=('LOCATION=/oradata/RCAT/arch') MANDATORY REOPEN
 LOG_ARCHIVE_FORMAT='%t_%s.arc'
 LOG_ARCHIVE_START=TRUE
 # DISPATCHERS='(PROTOCOL=TCP)(DISPATCHERS=1)'
 # SHARED_SERVERS=1
 # MAX_DISPATCHERS=5
 # MAX_SHARED_SERVERS=8
 UTL_FILE_DIR='/oradata/RCAT/logmnr'
 BACKGROUND_DUMP_DEST='/oradata/RCAT/bdump'
 CORE_DUMP_DEST='/oradata/RCAT/cdump'
 USER_DUMP_DEST='/oradata/RCAT/udump'
 CONTROL_FILES=('/oradata/RCAT/data/RCAT_ctrl01','/oradata/RCAT/data/RCAT_ctrl02','/oradata/RCAT/data/RCAT_ctrl03')
 DB_DOMAIN='PKIBM.COM'
 DB_NAME='RCAT'
 INSTANCE_NAME='RCAT'
 UNDO_MANAGEMENT=AUTO
 UNDO_RETENTION=7200
 UNDO_TABLESPACE='UNDOTBS'
 DB_FILE_MULTIBLOCK_READ_COUNT=16
 OPEN_CURSORS=100
 OPTIMIZER_MODE=CHOOSE
 CURSOR_SHARING=SIMILAR
 TIMED_STATISTICS=TRUE
 COMPATIBLE=9.2.0.0.0
 HASH_JOIN_ENABLED=TRUE
 STAR_TRANSFORMATION_ENABLED=FALSE
 QUERY_REWRITE_ENABLED=TRUE
 QUERY_REWRITE_INTEGRITY=TRUSTED
 PROCESSES=200
 FAST_START_MTTR_TARGET=300
 REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
 DML_LOCKS=2048
 O7_DICTIONARY_ACCESSIBILITY=FALSE
 WORKAREA_SIZE_POLICY=AUTO
 JOB_QUEUE_PROCESSES=2
 REPLICATION_DEPENDENCY_TRACKING=TRUE
 OPEN_LINKS=2
 GLOBAL_NAMES=FALSE
 AQ_TM_PROCESSES=1

RCATcreate.sql

 CONNECT SYS/pkibm AS SYSDBA
 SET ECHO ON
 SPOOL createDB.log
 STARTUP NOMOUNT PFILE='/oraapp/oracle/92/dbs/initRCAT.ora'
 CREATE DATABASE RCAT
 LOGFILE
 GROUP 1 ('/oradata/RCAT/data/RCAT_redo11','/oradata/RCAT/data/RCAT_redo12') SIZE 50M,
 GROUP 2 ('/oradata/RCAT/data/RCAT_redo21','/oradata/RCAT/data/RCAT_redo22') SIZE 50M,
 GROUP 3 ('/oradata/RCAT/data/RCAT_redo31','/oradata/RCAT/data/RCAT_redo32') SIZE 50M
 MAXINSTANCES 4
 MAXLOGHISTORY 1
 MAXLOGFILES 12
 MAXLOGMEMBERS 3
 MAXDATAFILES 1024
 NOARCHIVELOG
 CHARACTER SET ZHS16GBK
 NATIONAL CHARACTER SET AL16UTF16
 DATAFILE '/oradata/RCAT/data/RCAT_system01' SIZE 300M REUSE
 AUTOEXTEND ON NEXT 50M MAXSIZE 2000M
 UNDO TABLESPACE UNDOTBS
 DATAFILE '/oradata/RCAT/data/RCAT_undo01' SIZE 10M REUSE
 AUTOEXTEND ON NEXT 10M MAXSIZE 2000M EXTENT MANAGEMENT LOCAL
 DEFAULT TEMPORARY TABLESPACE TEMPTBS
 TEMPFILE '/oradata/RCAT/data/RCAT_temp01' SIZE 10M REUSE
 AUTOEXTEND ON NEXT 5M MAXSIZE 2000M
 EXTENT MANAGEMENT LOCAL UNIFORM SIZE 512K;
 SET ECHO OFF
 @/oraapp/oracle/92/rdbms/admin/catalog.sql;
 @/oraapp/oracle/92/rdbms/admin/catproc.sql;
 CONNECT SYS/pkibm AS SYSDBA
 ALTER USER SYS IDENTIFIED BY pkibm;
 ALTER USER SYSTEM IDENTIFIED BY pkibm;
 connect SYSTEM/pkibm
 @/oraapp/oracle/92/sqlplus/admin/pupbld.sql;
 connect SYSTEM/pkibm
 @/oraapp/oracle/92/sqlplus/admin/hlpbld.sql helpus.sql;
 CONNECT SYS/pkibm AS SYSDBA
 SET ECHO ON
 SHUTDOWN IMMEDIATE
 CONNECT SYS/pkibm AS SYSDBA
 STARTUP MOUNT PFILE='/oraapp/oracle/92/dbs/initRCAT.ora'
 ALTER DATABASE ARCHIVELOG;
 ALTER DATABASE OPEN;
 CREATE SPFILE FROM PFILE='/oraapp/oracle/92/dbs/initRCAT.ora';
 SHUTDOWN IMMEDIATE;
 CONNECT SYS/pkibm AS SYSDBA
 STARTUP
 CREATE TABLESPACE sysaux
 DATAFILE '/oradata/RCAT/data/RCAT_sysaux01' SIZE 10M
 AUTOEXTEND ON NEXT 5M MAXSIZE 2000M
 LOGGING ONLINE PERMANENT EXTENT MANAGEMENT LOCAL
 SEGMENT SPACE MANAGEMENT AUTO UNIFORM SIZE 128K;
 DROP TABLE outln.ol$ ;
 CREATE TABLE outln.ol$(
 ol_name VARCHAR2(30),sql_text LONG,textlen NUMBER,
 signature RAW(16),hash_value NUMBER,hash_value2 NUMBER,
 category VARCHAR2(30),version VARCHAR2(64),creator VARCHAR2(30),
 timestamp DATE,flags NUMBER,hintcount NUMBER,spare1 NUMBER,
 spare2 VARCHAR2(1000))TABLESPACE sysaux INITRANS 4;
 ALTER TABLE outln.ol$hints MOVE TABLESPACE sysaux INITRANS 4;
 ALTER TABLE outln.ol$nodes MOVE TABLESPACE sysaux INITRANS 4;
 ALTER USER outln  DEFAULT TABLESPACE sysaux;
 ALTER USER outln  IDENTIFIED BY LOCKEDBYDBA ACCOUNT LOCK;
 ALTER USER dbsnmp  DEFAULT TABLESPACE sysaux;
 ALTER USER dbsnmp  IDENTIFIED BY LOCKEDBYDBA ACCOUNT LOCK;
 CREATE USER PKIBM IDENTIFIED BY PKIBM ACCOUNT UNLOCK;
 GRANT CREATE SESSION TO PKIBM;
 ALTER USER PKIBM  DEFAULT TABLESPACE sysaux;
 ALTER USER PKIBM  ACCOUNT UNLOCK;
 REVOKE UNLIMITED TABLESPACE FROM PKIBM;
 ALTER USER PKIBM QUOTA UNLIMITED ON sysaux;
 SPOOL OFF
 DISCONNECT
 EXIT

RCATcreate.sh

 #!/bin/sh
 mkdir -p /oradata/RCAT/bdump
 mkdir -p /oradata/RCAT/cdump
 mkdir -p /oradata/RCAT/udump
 mkdir -p /oradata/RCAT/data
 mkdir -p /oradata/RCAT/arch
 mkdir -p /oradata/RCAT/bkup
 mkdir -p /oradata/RCAT/logmnr
 export ORACLE_SID=RCAT
 cp  ./RCATinit.ora  /oraapp/oracle/92/dbs/initRCAT.ora
 /oraapp/oracle/92/bin/orapwd file=/oraapp/oracle/92/dbs/orapwRCAT password=pkibm entries=5
 /oraapp/oracle/92/bin/sqlplus /nolog @./RCATcreate.sql
 cp ./RCATlistener.ora /oraapp/oracle/92/network/admin/listener.ora
 cp ./RCATtnsnames.ora /oraapp/oracle/92/network/admin/tnsnames.ora
 /oraapp/oracle/92/bin/lsnrctl stop
 /oraapp/oracle/92/bin/lsnrctl start

tnsnames.ora

 RCAT =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1688))
   )
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SID = RCAT)
   )
 )

 PROD =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
   )
   (CONNECT_DATA =
     (SERVER = DEDICATED)
     (SID = PROD)
   )
 )

listener.ora

 LISTENER =
   (DESCRIPTION_LIST =
     (DESCRIPTION =
       (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
     )
     (DESCRIPTION =
       (ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1688))
     )
   )

 SID_LIST_LISTENER =
   (SID_LIST =
     (SID_DESC =
       (GLOBAL_DBNAME = RCAT.PKIBM.COM)
       (ORACLE_HOME = /oraapp/oracle/92)
       (SID_NAME = RCAT)
     )
     (SID_DESC =
       (GLOBAL_DBNAME = PROD.PKIBM.COM)
       (ORACLE_HOME = /oraapp/oracle/92)
       (SID_NAME = PROD)
     )
   )


##################################################
####################RMAN配置####################
##################################################

1.在目录数据库中创建恢复目录所需的表空间
  CREATE TABLESPACE rman_ts DATAFILE '/oradata/RCAT/data/rman.dbf' SIZE 200m;
  PS:删除掉该表空间 DROP TABLESPACE rman_ts INCLUDING CONTENTS;
2.在目录数据库中创建RMAN用户
  CREATE USER rman IDENTIFIED BY rman
  DEFAULT TABLESPACE rman_ts
  TEMPORARY TABLESPACE TEMP
  QUOTA UNLIMITED ON rman_ts;
  PS:删除用户  DROP USER rman CASCADE;
3.给rman用户授权
  GRANT recovery_catalog_owner,connect,resource TO rman;
4.新开启一个CMD
  rman catalog rman/rman
  或者: -C:\>rman
        -RMAN>connect catalog rman/rman@idba;
        -RMAN>create catalog tablespace rman_ts //创建catalog于rman_ts表空间
5.在D:\oracle\ora92\network\admin\tnsnames.ora建立
  PROD =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.123.127)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = IDBA)
    )
  )
6.以sys用户登陆上生产数据库上创建备份用户
  -SQL>CREATE USER rman IDENTIFIED BY rman
  -SQL>GRANT sysdba TO rman;
7.连接上生产数据库注册
  -RMAN>CONNECT TARGET rman/rman@prod
  -RMAN>REGISTER DATABASE

##################################################
####################crontab -e####################
##################################################

0 2 28 1 *    /oraapp/oracle/dba/full_bkup.sh
10 0 * * 0    /oraapp/oracle/dba/lev0_bkup.sh
10 0 * * 1-2  /oraapp/oracle/dba/lev2_bkup.sh
10 0 * * 3    /oraapp/oracle/dba/lev1_bkup.sh
10 0 * * 4-6  /oraapp/oracle/dba/lev2_bkup.sh
10 3 * * 0    /oraapp/oracle/dba/ora_wk.sh

##################################################
########/oraapp/oracle/dba/DBA_rename.sql#########
##################################################

 connect RMAN/RMAN@RCAT;
 set echo off
 set feedback off
 set linesize 1000
 set pagesize 0
 set verify off
 spool /oraapp/oracle/dba/log/rename.txt
 select 'dd bs=1024 if=&1 of=/oraapp/oracle/dba/log/RLog_'||to_char(sysdate,'d')||'.txt' from dual;
 spool off
 host chmod 755 /oraapp/oracle/dba/log/rename.txt
 host /oraapp/oracle/dba/log/rename.txt
 host rm -rf /oraapp/oracle/dba/log/rename.txt
 exit;

##################################################
###########/oraapp/oracle/dba/ora_os.sh###########
##################################################

 #!/bin/sh
 #
 # copy all backup files from the db server72
 #
 cp /hotbkup/data/orabk/* /hotbkup/data/tmp/ >>/oraapp/oracle/dba/log/bkup.log
 #
 # move the daily backup to current week directory
 #
 cp /hotbkup/data/tmp/* /offbkup/data/cweek/ >>/oraapp/oracle/dba/log/bkup.log
 #
 # remove the yestoday's backup files
 #
 rm -rf /hotbkup/data/day/* >>/oraapp/oracle/dba/log/bkup.log
 #
 # copy all the backup file to day directory
 #
 mv /hotbkup/data/tmp/* /hotbkup/data/day/ >>/oraapp/oracle/dba/log/bkup.log
 #
 # delete all the db server72's backup files to free diskspace
 # must delete at last for security
 #
 rm -rf /hotbkup/data/orabk/* >>/oraapp/oracle/dba/log/bkup.log
 #
 # list all the backup file
 #
 ls -l /hotbkup/data/orabk/ >>/oraapp/oracle/dba/log/bkup.log
 ls -l /hotbkup/data/tmp/ >>/oraapp/oracle/dba/log/bkup.log
 ls -l /hotbkup/data/day/ >>/oraapp/oracle/dba/log/bkup.log
 ls -l /offbkup/data/cweek/ >>/oraapp/oracle/dba/log/bkup.log
 #
 # send email to dba
 #
 mail -s "BK_`date "+%Y-%m-%d"`_log" westzq@hotmail.com </oraapp/oracle/dba/log/bkup.log

##################################################
###########/oraapp/oracle/dba/ora_wk.sh###########
##################################################

 #!/bin/sh
 #
 # remove all the last week backup files
 #
 rm -rf /offbkup/data/pweek/*
 #
 # move current week backup file to preview week folder
 #
 mv /offbkup/data/cweek/* /offbkup/data/pweek/

##################################################
#########/oraapp/oracle/dba/full_bkup.sh##########
##################################################

        #!/bin/sh
 export ORACLE_HOME=/oraapp/oracle/92
 export DBA_HOME=/oraapp/oracle/dba
 export ORACLE_SID=RCAT
 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
 export NLS_DATE_FORMAT='YYYY-MM-DD_HH24:MI:SS'
 $ORACLE_HOME/bin/rman cmdfile $DBA_HOME/full_bk.rcv msglog $DBA_HOME/log/bkup.log
 $ORACLE_HOME/bin/sqlplus /nolog @$DBA_HOME/DBA_rename.sql $DBA_HOME/log/bkup.log
 /oraapp/oracle/dba/ora_os.sh &

##################################################
#########/oraapp/oracle/dba/full_bkup.rcv#########
##################################################

 connect catalog RMAN/RMAN@RCAT;
 connect target RMAN/RMAN@PROD;
 run {
 allocate channel ch1 device type disk;
 allocate channel ch2 device type disk;
 backup full filesperset=2 tag='Full_%d' format='/oradata/orabk/%T_full_%d_%s_%p' database include current controlfile;
 sql 'alter system archive log current';
 backup filesperset=4 format='/oradata/orabk/arch_%T_%d_%s_%p' archivelog all delete input;
 release channel ch1;
 release channel ch2;
 }
 quit;

##################################################
#########/oraapp/oracle/dba/lev0_bkup.sh##########
##################################################

 #!/bin/sh
 export ORACLE_HOME=/oraapp/oracle/92
 export DBA_HOME=/oraapp/oracle/dba
 export ORACLE_SID=RCVCAT
 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
 export NLS_DATE_FORMAT='YYYY-MM-DD_HH24:MI:SS'
 $ORACLE_HOME/bin/rman cmdfile $DBA_HOME/lev0_bkup.rcv log $DBA_HOME/log/bkup.log
 $ORACLE_HOME/bin/sqlplus /nolog @$DBA_HOME/DBA_rename.sql $DBA_HOME/log/bkup.log
 /oraapp/oracle/dba/ora_os.sh &

##################################################
#########/oraapp/oracle/dba/lev0_bkup.rcv#########
##################################################

 connect catalog RMAN/RMAN@RCAT;
 connect target RMAN/RMAN@PROD;
 run {
 allocate channel ch1 device type disk;
 allocate channel ch2 device type disk;
 backup incremental level=0 filesperset=2 tag='Lev0_%d' format='/oradata/orabk/%T_lev0_%d_%s_%p' database include current controlfile;
 sql 'alter system archive log current';
 backup filesperset=4 format='/oradata/orabk/arch_%T_%d_%s_%p'
 archivelog all delete input;
 release channel ch1;
 release channel ch2;
 }
 quit;

##################################################
#########/oraapp/oracle/dba/lev1_bkup.sh##########
##################################################

 #!/bin/sh
 export ORACLE_HOME=/oraapp/oracle/92
 export DBA_HOME=/oraapp/oracle/dba
 export ORACLE_SID=RCAT
 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
 export NLS_DATE_FORMAT='YYYY-MM-DD_HH24:MI:SS'
 $ORACLE_HOME/bin/rman cmdfile $DBA_HOME/lev1_bkup.rcv log $DBA_HOME/log/bkup.log
 $ORACLE_HOME/bin/sqlplus /nolog @$DBA_HOME/DBA_rename.sql $DBA_HOME/log/bkup.log
 /oraapp/oracle/dba/ora_os.sh &

##################################################
#########/oraapp/oracle/dba/lev1_bkup.rcv#########
##################################################
 connect catalog RMAN/RMAN@RCAT;
 connect target RMAN/RMAN@PROD;
 run {
 allocate channel ch1 device type disk;
 allocate channel ch2 device type disk;
 backup incremental
 level=1
 filesperset=2
 tag='Lev1_%d'
 format='/oradata/orabk/%T_lev1_%d_%s_%p'
 database include current controlfile;
 sql 'alter system archive log current';
 backup filesperset=4
 format='/oradata/orabk/arch_%T_%d_%s_%p'
 archivelog all delete input;
 release channel ch1;
 release channel ch2;
 }
 quit;

##################################################
#########/oraapp/oracle/dba/lev2_bkup.sh##########
##################################################

 #!/bin/sh
 export ORACLE_HOME=/oraapp/oracle/92
 export DBA_HOME=/oraapp/oracle/dba
 export ORACLE_SID=RCVCAT
 export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
 export NLS_DATE_FORMAT='YYYY-MM-DD_HH24:MI:SS'
 $ORACLE_HOME/bin/rman cmdfile $DBA_HOME/lev2_bkup.rcv log $DBA_HOME/log/bkup.log
 $ORACLE_HOME/bin/sqlplus /nolog @$DBA_HOME/DBA_rename.sql $DBA_HOME/log/bkup.log
 /oraapp/oracle/dba/ora_os.sh &

##################################################
#########/oraapp/oracle/dba/lev2_bkup.rcv#########
##################################################

 connect catalog RMAN/RMAN@RCAT;
 connect target RMAN/RMAN@PROD;
 run {
 allocate channel ch1 device type disk;
 allocate channel ch2 device type disk;
 backup incremental
 level=2
 filesperset=2
 tag='Lev2_%d'
 format='/oradata/orabk/%T_lev2_%d_%s_%p'
 database include current controlfile;
 sql 'alter system archive log current';
 backup filesperset=4
 format='/oradata/orabk/arch_%T_%d_%s_%p'
 archivelog all delete input;
 release channel ch1;
 release channel ch2;
 }
 quit;

 

分享到:
评论

相关推荐

    手把手教你ORACLE RMAN异地备份

    "手把手教你ORACLE RMAN异地备份" 该教程旨在教你如何使用ORACLE RMAN实现异地备份,解决了由于数据量急剧增加、备份和恢复的困难问题。通过使用RMAN和EXP/IMP工具,用户可以实现本地数据库的异地备份,避免服务器...

    oraclerman备份原理[参照].pdf

    Oracle 数据库在线备份原理 Oracle 数据库在线备份原理是指在 Oracle 数据库中对数据库进行在线备份的基本原理和方法。该原理是基于 Oracle 数据库的基本概念和机制,包括表、数据查询语句、DML 语句和 DDL 语句等...

    Oracle RMAN快速入门指南

    oracle rman 的使用介绍,对rman一些场景恢复进行案例分析

    顶级DBA漫谈Oracle Rman备份与恢复

    Oracle RMAN 备份与恢复概述 Oracle RMAN(Recovery Manager)是一种强大的备份和恢复工具,旨在帮助DBA管理员更好地管理和保护Oracle数据库。以下是Oracle RMAN备份与恢复的相关知识点: 备份恢复概述 备份恢复...

    Oracle Rman命令详解

    ### Oracle Rman命令详解 #### 一、RMAN命令类型及使用场景 ##### 1.1 独立命令(Standalone Command) 独立命令是指在RMAN中可以直接执行的命令,这类命令通常不依赖于其他命令,能够独立完成某个功能。例如备份表...

    oracle RMAN 功能介绍 ppt

    Oracle Recovery Manager (RMAN) 是Oracle数据库管理系统中的一个重要工具,主要负责数据库的备份、恢复以及相关的维护工作。在“Oracle RMAN 功能介绍 ppt”中,我们深入探讨了RMAN的关键特性和操作流程。 首先,...

    window oracle rman 增量备份脚本

    window oracle rman 增量备份脚本

    Oracle 12c Rman Backup and Recovery

    ### Oracle 12c RMAN备份与恢复技术详解 #### 一、RMAN(Recovery Manager)概述 在Oracle 12c版本中,RMAN是用于管理数据库备份和恢复的强大工具。它不仅可以帮助管理员执行数据库备份,还能进行灾难恢复操作,...

    oracle RMAN的使用

    RMAN只能用于ORACLE8或更高的版本中。它能够备份整个数据 库或数据库部件,如表空间、数据文件、控制文件、归档文件以及Spfile参数文件。RMAN 也允许您进行增量数据块级别的备份,增量RMAN备份是时间和空间有效的,...

    一步一步学RMAN oracle备份RMAN使用教程

    不错的oracle备份教程。 一、进入rman 二、rman命令知多少 三、rman备份演练初级篇 四、rman备份演练进阶篇 五、rman外传-基础资料篇1 六、实战rman备份 七、rman外传-基础资料篇2 八、演练rman恢复 九、实战rman...

    ORACLE RMAN备份脚本

    ### ORACLE RMAN备份脚本知识点解析 #### 一、RMAN简介 RMAN(Recovery Manager)是Oracle数据库提供的一种强大的数据恢复管理工具。它主要用于执行物理备份、恢复操作及灾难恢复等任务。通过RMAN可以实现对数据库...

    傻瓜式实战OracleRMAN数据库备份和恢复视频

    教程名称:傻瓜式实战Oracle RMAN数据库备份和恢复视频课程目录:【】数据库备份和恢复系列].ITBOBA_RMAN_1【】数据库备份和恢复系列].ITBOBA_RMAN_10【】数据库备份和恢复系列].ITBOBA_RMAN_2【】数据库备份和恢复...

    一个完整的Oracle rman备份恢复参考示例

    Oracle RMAN(Recovery Manager)是Oracle数据库管理系统中用于数据备份和恢复的重要工具。它提供了全面的数据保护功能,包括完整数据库备份、增量备份、表空间备份以及数据文件级别的备份。以下是一个详细的Oracle ...

    Oracle RMAN

    旧版Oracle Rman 备份!

    Veeam Rman Plugin for Oracle安装和使用手册.docx

    "VEEAM Rman Plugin for Oracle安装和使用手册" VEEAM Rman Plugin for Oracle是VEEAM公司开发的一款插件,旨在为Oracle RAC数据库提供备份和恢复解决方案。该插件可以与VEEAM Backup & Replication集成,提供了一...

    windows下oracle rman备份 计划任务

    4. **权限设置**:确保计划任务的服务账户具有执行RMAN命令所需的权限,包括对数据库的访问权和写入备份目标的权限。 5. **监控和调整**:定期检查计划任务的执行情况,查看日志文件以确认备份成功。根据需要调整...

    oracle RMAN 备份恢复总结

    Oracle Recovery Manager(RMAN)是Oracle数据库管理系统中的一个重要组件,专为数据库的备份、恢复和维护设计。RMAN 自从Oracle 8版本开始引入,并在后续版本中不断加强和完善,尤其在Oracle 9i中展现出更为强大的...

Global site tag (gtag.js) - Google Analytics