RedHat5下安装Oracle10文档


数据库 Oracle10.2.0.1.0 版本在 Linux RadHat Enterprise5 安装文 档 北京 XXXX 有限公司 版本说明 文件状态: [ ] 草稿 [√] 正式发布 [ ] 正在修改 文件标识: 现场实施标准文档 当前版本: 1.0 作 者: XX 完成日期: 2008 年 03 月 05 日 版本 日期 描 述 作者 审核 2008-03-05 Oracle10g 安装说明 XX 目 录 1 前言 ............................................................................................................................................................................ 3 1.1 安装 Oracle 的环境 ........................................................................................................................................ 3 1.2 查询所需安装包是否完整 ............................................................................................................................ 4 1.3 检查安装 Oracle 的硬件要求 ........................................................................................................................ 6 1.4 OS 参数要求 vi /etc/sysctl.conf , 在行末添加以下内容 .............................................................................. 7 1.5 vi /etc/security/limits.conf 行末添加以下内容 ........................................................................................... 10 1.6 vi /etc/pam.d/login 行末添加以下内容 ....................................................................................................... 10 1.7 vi /etc/selinux/config 确保以下内容 ........................................................................................................... 11 2 创建安装 Oracle 的用户、组及配置 ..................................................................................................................... 12 2.1 解压 10201_database_linux32.zip ............................................................................................................... 12 2.2 创建安装 Oracle 的用户及所属组 .............................................................................................................. 12 2.3 创建安装目录 mkdir -p /opt/app/oracle/product/10.2 ................................................................................. 13 2.4 设置 oracle 用户的 .bash_profile .................................................................................................................. 14 2.5 设置主机名和 ip .......................................................................................................................................... 15 2.6 设置 Oracle10g 支持 RHEL5 的参数 .......................................................................................................... 15 3 安装 Oracle .............................................................................................................................................................. 17 3.1 用 oracle 用户运行 runInstaller 文件 ........................................................................................................... 17 4 测试 Oracle 是否安装成功 ..................................................................................................................................... 28 4.1 启动 Oracle 服务 .......................................................................................................................................... 28 4.2 访问数据库的 Web 界面 ............................................................................................................................. 32 4.3 oracle10g 字符集的修改 .............................................................................................................................. 35 4.4 oracle10g 热备份脚本 .................................................................................................................................. 37 第 2 页 共 38 页 1 前言 看过很多很多文档,有些文档格式难看,有些则是图形不够全面。个人喜欢一些格式整齐,全面的图 形界面,文字清晰的文档。本文档的目的是让不接触 Oracle 的人能够顺利的安装上 Oracle 服务器。安装时 在网上参考了很多文档,在此表示感谢! 主要参考文档: h ttp://bbs.chinaunix.net/thread-1035512-1-1.html http://davidtao88.jiancss.com/archives/1041208/ http://www.idevelopment.info/data/Oracle/DBA_tips/Linux/LINUX_15.shtml http://bbs.chinaunix.net/viewthread.php?tid=1063336 http://www.oracle-base.com/articles/10g/OracleDB10gR2InstallationOnRHEL5.php http://www.dbspecialists.com/presentations/oracle10glinux.html http://hi.baidu.com/dbaeyes/blog/item/d920ad5426e46f5cd10906d7.html rpm 包查询地址:http://rpm.pbone.net/ 1.1 安装 Oracle 的环境  Linux RedHat EnterPrise5 默认安装(自定义软件时,全选)  /opt/setup080305/目录:下载的 10201_database_linux32.zip 放在该目录  /u01/app/oracle/目录:为 Oracle 安装的 ORACLE_BASE  服务器为 HP DL380G5 2*双核 Intel Xeon 5140 (2.33 GHz),内存 4 GB 安装 Oracle 前的准备很重要。 Oracle10g for linux32 下载地址: http://www.oracle.com/technology/software/products/database/index.html ftp:// 202.96.64.144/pub http://mirrors.cn99.com/oracle/10g/ 第 3 页 共 38 页 1.2 查询所需安装包是否完整 进入系统,用 root 用户,终端命令: # rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat- libstdc++-devel 运行结果如图: gcc-4.1.1-52.el5 make-3.81-1.1 binutils-2.17.50.0.6-2.el5 package openmotif is not installed setarch-2.0-1.1 package compat-db is not installed package compat-gcc is not installed package compat-gcc-c++ is not installed package compat-libstdc++ is not installed package compat-libstdc++-devel is not installed 缺少的都需要安装相关的软件包, RHEL_5 i386 DVD 光盘中,请参考安装下面的包: # 从 RHEL_5 i386 DVD 光 盘 中 ( 按 照 以 下 的 顺 序 安 装 ) rpm -Uvh compat-db-4* rpm -Uvh libaio-0* rpm -Uvh compat-libstdc++-33-3* rpm -Uvh compat-gcc-34-3* rpm -Uvh compat-gcc-34-c++-3* rpm -Uvh libXp-1* rpm -Uvh openmotif-2* rpm -Uvh gcc-4* 第 4 页 共 38 页 rpm -Uvh glibc-2.5-12.i686.rpm 如图: 然后在检查需要的软件包都安装成功。 如图: 第 5 页 共 38 页 出现上图的界面则可以进行下一步安装。 注: [root@zjinterface Server]# rpm -q gcc make binutils openmotif setarch compat-db compat-gcc compat-gcc-c++ compat-libstdc++ compat-libstdc++-devel gcc-4.1.1-52.el5 make-3.81-1.1 binutils-2.17.50.0.6-2.el5 openmotif-2.3.0-0.3.el5 setarch-2.0-1.1 compat-db-4.2.52-5.1 package compat-gcc is not installed package compat-gcc-c++ is not installed package compat-libstdc++ is not installed package compat-libstdc++-devel is not installed [root@zjinterface Server]# 注:安装后一直都是报 libstdc 以及 gcc-c 没有安装 实际上已经安装成功了不知道为什么这样 1.3 检查安装 Oracle 的硬件要求 内存,交换区,硬盘空间等。如图: 第 6 页 共 38 页 [root@zjinterface Server]# grep MemTotal /proc/meminfo MemTotal: 3368196 kB [root@zjinterface Server]# grep SwapTotal /proc/meminfo SwapTotal: 2031608 kB [root@zjinterface Server]# df -lh /dev/mapper/VolGroup00-LogVol00 11G 344M 9.7G 4% / /dev/cciss/c0d0p1 99M 11M 83M 12% /boot tmpfs 1.7G 0 1.7G 0% /dev/shm /dev/cciss/c0d0p5 9.7G 151M 9.1G 2% /home /dev/cciss/c0d0p2 24G 1.3G 22G 6% /opt /dev/cciss/c0d0p7 3.0G 69M 2.8G 3% /tmp /dev/cciss/c0d0p3 9.7G 2.8G 6.5G 30% /usr /dev/cciss/c0d0p6 7.7G 203M 7.1G 3% /var /dev/hda 2.7G 2.7G 0 100% /media/RHEL_5 i386 DVD 1.4 OS 参数要求 vi /etc/sysctl.conf , 在行末添加以下内容 #use for oracle kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 250 32000 100 128 fs.file-max = 65536 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default=262144 第 7 页 共 38 页 net.core.rmem_max=262144 net.core.wmem_default=262144 net.core.wmem_max=262144 再运行 sysctl -p 应用以上参数 如图: 第 8 页 共 38 页 [root@zjinterface Server]# sysctl -p net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 4294967295 kernel.shmall = 268435456 kernel.shmall = 2097152 kernel.shmmax = 2147483648 kernel.shmmni = 4096 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 第 9 页 共 38 页 1.5 vi /etc/security/limits.conf 行末添加以下内容 #use for oracle * soft nproc 2047 * hard nproc 16384 * soft nofile 1024 * hard nofile 65536 如图: 1.6 vi /etc/pam.d/login 行末添加以下内容 session required pam_limits.so 如图: 第 10 页 共 38 页 1.7 vi /etc/selinux/config 确保以下内容 SELINUX=disabled 关闭 SELIINUX 如图: 到此准备安装 Oracle 的相关参数告一段落。 第 11 页 共 38 页 2 创建安装 Oracle 的用户、组及配置 2.1 解压 10201_database_linux32.zip 我把 10201_database_linux32.zip 放在了/opt/setup080305 下 终端命令: chmod –R 777 /opt/setup080305 (让 oracle 可以有权限执行安装文件) unzip 10201_database_linux32.zip 如图: 2.2 创建安装 Oracle 的用户及所属组 #groupadd oinstall #groupadd dba #useradd -m -g oinstall -G dba oracle #id oracle 为 Oracle 用 户 设 置 密 码 : #passwd oracle 如图: 第 12 页 共 38 页 2.3 创建安装目录 mkdir -p /opt/app/oracle/product/10.2 # chown -R oracle.oinstall /opt/app/oracle/product/10.2 # chmod -R 775 /opt/app/oracle/product/10.2 如图: 第 13 页 共 38 页 2.4 设置 oracle 用户的.bash_profile 在改文件的末行加上#Oracle Settings 下的内容, # Oracle Settings TMP=/tmp; export TMP TMPDIR=$TMP; export TMPDIR ORACLE_BASE=/opt/app/oracle; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/10.2/; export ORACLE_HOME ORACLE_SID=xxxxx; export ORACLE_SID ORACLE_TERM=xterm; export ORACLE_TERM PATH=/usr/sbin:$PATH; export PATH PATH=$ORACLE_HOME/bin:$PATH; export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi 如图: 第 14 页 共 38 页 2.5 设置主机名和 ip vi /etc/hosts 内容:60.12.128.186 zjinterface testdbserver 保存后在终端运行命令: #hostname 是否主机名变成了 zjinterface ,如果没有改变则要运行以下命令 #service network restart 如图: 2.6 设置 Oracle10g 支持 RHEL5 的参数 因为在官方的 Oracle10g 是不支持 RHEL5 的,所以需要改变相关的参数,不然在 Oracle10g 安装前不 能通过检测!网上有两种更改的方法:(本人按照第一种方法安装成功,第二种安装不能成功) 第一种:所以要修改版本说明,编辑文件 /etc/redhat-release 把 Red Hat Enterprise Linux Server release 5 (Tikanga) 改成版本 4:redhat-4 第 15 页 共 38 页 第二种:更改 10201_database_linux32.zip 解压后的/database/install/oraparam.ini 文件。本人比较倾向于第一 种,因为这种修改,在 Oracle 安装时第一次检测可以通过,但安装到一般时,再次检测无法通过,导致 安装不成功!(个人观点) ### #[Certified Versions] Linux=redhat-3,SuSE-9,redhat-4,redhat-5,UnitedLinux-1.0,asianux-1,asianux-2] 再 添 加 [Linux-redhat-5.0-optional] TEMP_SPACE=80 SWAP_SPACE=150 MIN_DISPLAY_COLORS=256 如图: 上面的准备,都是为了能够成功安装,下面就可以运行 oracle 的安装文件了。 第 16 页 共 38 页 3 安装 Oracle 3.1 用 oracle 用户运行 runInstaller 文件 不能用 root 用户安装 Oracle 数据库,在 root 用户下,新建一个终端,然后切换到 oracle 用户来安装, 也不行! 这样则会出现下图的错误信息: 所以需要注销到 oracle 用户下,或者是重起机器用 oracle 用户登陆。 执行命令: 切换到运行文件的目录: #cd /opt/setup080305/database #xhost + # export DISPLAY='60.12.128.185:0.0' # unset LANG (设置默认字符码) #./runInstanller 如图: 第 17 页 共 38 页 然后出现最受欢迎的界面: Next 第 18 页 共 38 页 Next 在这里所有的验证都通过了! (两行*号之间的大家不用看,如果检测不通过,则可以参考) 插一段话,如果没有出现上面的界面,最好重新检查还缺少什么东西。如果出现下面的界面,就先停止安装。 第 19 页 共 38 页 在这里有 2 个警告,4 个要求没有通过。 我们看看都什么警告和要求: Checking operating system requirements ... Expected result: One of redhat-3,redhat-4,SuSE-9,asianux-1,asianux-2 Actual Result: redhat-Red Hat Enterprise Linux Server release 5 (Tikanga) Check complete. The overall result of this check is: Failed <<<< Problem: Oracle Database 10g is not certified on the current operating system. Recommendation: Make sure you are installing the software on the correct platform. 这里说不支持 RHEL5 系统,如果按照上面的第二种则会出现,按照第一种方式修改则通过检测 Checking operating system package requirements ... Check complete. The overall result of this check is: Not executed <<<< OUI-18001: The operating system 'Linux Version redhat-Red Hat Enterprise Linux Server release 5 (Tikanga)' is not supported. Recommendation: Install the required packages before continuing with the installation. 这里说不支持 RHEL5 系统,如果按照上面的第二种则会出现,按照第一种方式修改则通过检测 Checking kernel parameters Check complete. The overall result of this check is: Not executed <<<< OUI-18001: The operating system 'Linux Version redhat-Red Hat Enterprise Linux Server release 5 (Tikanga)' is not supported. Recommendation: Perform operating system specific instructions to update the kernel parameters. 这里说不支持 RHEL5 系统,如果按照上面的第二种则会出现,按照第一种方式修改则通过检测 Checking Recommended glibc version Check complete. The overall result of this check is: Not executed <<<< OUI-18001: The operating system 'Linux Version redhat-Red Hat Enterprise Linux Server release 5 (Tikanga)' is not supported. 第 20 页 共 38 页 Recommendation: You may actually have installed packages which have obsoleted these, in which case you can successfully continue with the install. If you have not, it is recommended that you do not continue. Refer to the readme to find out how to get the missing packages. 这里说不支持 RHEL5 系统,如果按照上面的第二种则会出现,按照第一种方式修改则通过检测 Checking available swap space requirements ... Expected result: 1416MB Actual Result: 0MB Check complete. The overall result of this check is: Failed <<<< Problem: The system does not have the required swap space. Recommendation: Make more swap space available to perform the install. 这里是交换空间要求为 1416MB,而我的系统为 0,现在我把它改为 1800MB. 执行图形中的命令即可。 Checking Network Configuration requirements ... Actual Result: :java.lang.NullPointerException:Exception/Error Occurred Check complete. The overall result of this check is: Not executed <<<< Recommendation: Oracle supports installations on systems with DHCP-assigned public IP addresses. However, the primary network interface on the system should be configured with a static IP address in order for the Oracle Software to function properly. See the Installation Guide for more details on installing the software on systems configured with DHCP. 这里不支持动态的 ip 地址,修改上面提到的/etc/hosts 文件即可。 Vi /etc/hosts 内容:192.168.130.189 zjinterface dbserver 保存后在终端运行命令: #hostname 第 21 页 共 38 页 是否主机名变成了 zjinterface,如果没有改变则要运行以下命令 #service network restart 以下是我在实际安装过程中的报错: Checking operating system requirements ... Expected result: One of redhat-3,redhat-4,SuSE-9,asianux-1,asianux-2 Actual Result: redhat-4 Check complete. The overall result of this check is: Passed ======================================================================= Checking operating system package requirements ... Checking for make-3.79; found make-1:3.81-1.1. Passed Checking for binutils-2.14; found binutils-2.17.50.0.6-2.el5. Passed Checking for gcc-3.2; found gcc-4.1.1-52.el5. Passed Checking for libaio-0.3.96; found libaio-0.3.106-3.2. Passed Check complete. The overall result of this check is: Passed ======================================================================= Checking kernel parameters Checking for semmsl=250; found semmsl=250. Passed Checking for semmns=32000; found semmns=32000. Passed Checking for semopm=100; found semopm=100. Passed Checking for semmni=128; found semmni=128. Passed Checking for shmmax=536870912; found shmmax=2147483648. Passed Checking for shmmni=4096; found shmmni=4096. Passed Checking for shmall=2097152; found shmall=2097152. Passed Checking for file-max=65536; found file-max=65536. Passed Checking for VERSION=2.6.9; found VERSION=2.6.18-8.el5. Passed Checking for ip_local_port_range=1024 - 65000; found ip_local_port_range=1024 - 65000. Passed Checking for rmem_default=262144; found rmem_default=262144. Passed Checking for rmem_max=262144; found rmem_max=262144. Passed Checking for wmem_default=262144; found wmem_default=262144.Passed Checking for wmem_max=262144; found wmem_max=262144.Passed Check complete. The overall result of this check is: Passed ======================================================================= Checking Recommended glibc version Expected result: ATLEAST=2.3.2-95.27 Actual Result: 2.5-12 Check complete. The overall result of this check is: Passed ======================================================================= Checking physical memory requirements ... Expected result: 922MB Actual Result: 3288MB 第 22 页 共 38 页 Check complete. The overall result of this check is: Passed ======================================================================= Checking available swap space requirements ... Expected result: 3288MB Actual Result: 1983MB Check complete. The overall result of this check is: Failed <<<< Problem: The system does not have the required swap space. Recommendation: Make more swap space available to perform the install. ======================================================================= 该错误是检测到 swap 空间不足 强行安装也通过 Checking Network Configuration requirements ... Check complete. The overall result of this check is: Not executed <<<< Recommendation: Oracle supports installations on systems with DHCP-assigned public IP addresses. However, the primary network interface on the system should be configured with a static IP address in order for the Oracle Software to function properly. See the Installation Guide for more details on installing the software on systems configured with DHCP. ======================================================================= Validating ORACLE_BASE location (if set) ... Check complete. The overall result of this check is: Passed ======================================================================= Checking Oracle Home path for spaces... Check complete. The overall result of this check is: Passed ======================================================================= Checking for proper system clean-up.... Check complete. The overall result of this check is: Passed ======================================================================= Checking for Oracle Home incompatibilities .... Actual Result: NEW_HOME Check complete. The overall result of this check is: Passed Next 第 23 页 共 38 页 Install 这是安装过程,然后出现: 第 24 页 共 38 页 OK 第 25 页 共 38 页 用 root 用户执行上面的 root.sh 文件,如图: [root@zjinterface product]# /opt/app/oracle/product/10.2/orainstRoot.sh Changing permissions of /opt/app/oracle/product/10.2 to 770. Changing groupname of /opt/app/oracle/product/10.2 to dba. The execution of the script is complete [root@zjinterface product]# /opt/app/oracle/product/10.2/root.sh Running Oracle10 root.sh script... The following environment variables are set as: ORACLE_OWNER= oracle ORACLE_HOME= /opt/app/oracle/product/10.2 Enter the full pathname of the local bin directory: [/usr/local/bin]: Copying dbhome to /usr/local/bin ... Copying oraenv to /usr/local/bin ... Copying coraenv to /usr/local/bin ... Creating /etc/oratab file... Entries will be added to the /etc/oratab file as needed by Database Configuration Assistant when a database is created Finished running generic part of root.sh script. Now product-specific root actions will be performed. 回来刚才的界面 第 26 页 共 38 页 OK Exit 第 27 页 共 38 页 Yes 到此安装完毕!终于结束了! 4 测试 Oracle 是否安装成功 4.1 启动 Oracle 服务 终端命令: [oracle@zjinterface database]$ sqlplus ' / as sysdba ' SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 5 14:09:51 2008 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 1002438656 bytes 第 28 页 共 38 页 Fixed Size 1223080 bytes Variable Size 251659864 bytes Database Buffers 742391808 bytes Redo Buffers 7163904 bytes ORA-01102: cannot mount database in EXCLUSIVE mode SQL> 重启服务器后 正常启动 [oracle@zjinterface ~]$ sqlplus ' / as sysdba ' SQL*Plus: Release 10.2.0.1.0 - Production on Wed Mar 5 14:23:33 2008 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance started. Total System Global Area 1002438656 bytes Fixed Size 1223080 bytes Variable Size 255854168 bytes Database Buffers 738197504 bytes Redo Buffers 7163904 bytes Database mounted. Database opened. SQL> 下面是别人在安装的时候遇到问题的解决方法: 如图: 第 29 页 共 38 页 发现在该目录下没有 initORCL.ora 文件。 如图: 复制一个 init.ora,命名为 initORCL.ora 终端命令:cp init.ora initORCL.ora 然后在重起 oracle,如图: 又出现错误: ORA-00371: not enough shared pool memory, should be atleast 62198988 bytes 请修改: vi $ORACLE_HOME/dbs/initORCL.ora 将其中的 shared_pool_size = 35000000 改成 62198988 重新启动 #sqlplus “/as sysdba” 第 30 页 共 38 页 SQL>startup 如图: ora-00205:error in identifying conrolfile, check alert log for more info 解决方法: SQL>show parameter control_files SQL>CREATE CONTROLFILE 将$ORACLE_BASE/admin/$GID/pfile/init$SID.ora***************拷贝到$ORACLE_HOME/dbs 下, 命名为 init$SID.ora,即可解决。 关闭后,重新启动 SQL>shutdown #sqlplus “/as sysdba” SQL>startup 如图: 第 31 页 共 38 页 如上图,oracle 启动正常! 4.2 访问数据库的 Web 界面 用浏览器打开 http://zjinterface:1158/em 如图: 怎么打开呢,往下看。终端启动 emctl start dbconsole 如图: 第 32 页 共 38 页 问题又来了,查看图中的目录,原来没有 OC4J_DBConsole_zjinterface_ORCL 文件夹,但是有 OC4J_DBConsole_zjinterface_orcl 文件夹,原来差个大小写,把 orcl 改成 ORCL,再重起命令#emctl start dbconsole 如下图: 检查上图目录,原来目录下没有 zjinterface_ORCL 文件夹,但有 zjinterface_orcl 文件夹,把 orcl 改成 ORCL, 并 修 改 /u01/app/oracle/product/10.2.0/db_1/zjinterface_ORCL/sysman/config/ 目 录 下 的 omsconfig.properties 文件,把 oracle.sysman.eml.mntr.emdRepSID=orcl 改成=ORCL. 如图: 终端启动: 第 33 页 共 38 页 #emctl start dbconsole 如图: 然后运行: #lsnrctl start 如图: 看到上图,可以轻松一下了。 再次打开浏览器:http://zjinterface:1158/em 第 34 页 共 38 页 用 sys 和 system 都可以登陆。完毕! 4.3 oracle10g 字符集的修改 http://2hei.net/mt/2007/12/oracle-nsl-lang-set.html 从 oracle9i 中导出的数据导入到 oracle 10g 中,经过程序的调用后,发现都是乱码,开始以 为是 RHEL5 系统字符集的事情,修改了几次后,发觉还是数据库的字符集有问题。 以下是用 dba 进入后查看拿的实际情况: select * from V$NLS_PARAMETERS ; NLS_LANGUAGE SIMPLIFIED CHINESE NLS_TERRITORY CHINA NLS_CURRENCY RMB NLS_ISO_CURRENCY CHINA NLS_NUMERIC_CHARACTERS ., NLS_CALENDAR GREGORIAN NLS_DATE_FORMAT DD-MON-RR NLS_DATE_LANGUAGE SIMPLIFIED CHINESE 第 35 页 共 38 页 NLS_CHARACTERSET WE8ISO8859P1 NLS_SORT BINARY NLS_TIME_FORMAT HH.MI.SSXFF AM NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AM NLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZR NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZR NLS_DUAL_CURRENCY RMB NLS_NCHAR_CHARACTERSET AL16UTF16 NLS_COMP BINARY NLS_LENGTH_SEMANTICS BYTE NLS_NCHAR_CONV_EXCP FALSE select userenv('language') from dual; SIMPLIFIED CHINESE_CHINA.WE8ISO8859P1 select * from sys.props$ WHERE NAME='NLS_CHARACTERSET'; ----------------------- 参考了网上的几个解决方法,都没有解决,最后还是使用了这样的方法解决了问题: UPDATE sys.PROPS$ SET value$='ZHS16GBK' WHERE NAME='NLS_CHARACTERSET'; 这样把 WE8ISO8859P1 改变成'ZHS16GBK' 。 但是原来已经导入的数据都需要重新导入。 *******需要说明的是 上面的这种方法有些问题,尽量不要使用这种方法 下面是正确的修改字符集的方法: sqlplus "/as sydba" shutdown immediate Startup restrict ALTER DATABASE CHARACTER SET ZHS16GBK 然后重启数据库即可,不过最好先做备份 浙江测试库的修改步骤 修改步骤: http://hi.baidu.com/ssms/blog/item/b93a951363bb12035aaf53d9.html connect system/oracle10g as sysdba; SQL>shutdown immediate; SQL>STARTUP MOUNT; SQL>ALTER SYSTEM ENABLE RESTRICTED SESSION; SQL>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0; SQL>ALTER SYSTEM SET AQ_TM_PROCESSES=0; SQL>ALTER DATABASE OPEN; SQL>ALTER DATABASE CHARACTER SET ZHS16GBK; ERROR at line 1: ORA-12721: operation cannot execute when other sessions are active 若出现上面的错误,使用下面的办法进行修改,使用 INTERNAL_USE 可以跳过超集的检查: ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK; 第 36 页 共 38 页 SQL>shutdown immediate; SQL>startup; SQL> select userenv('language') from dual; USERENV('LANGUAGE') --------------------------------------------------- AMERICAN_AMERICA.ZHS16GBK 4.4 oracle10g 热备份脚本 备份脚本:open_backup.sql 所在目录:/u01/open_backup 脚本内容: set feedback off pagesize 0 heading off verify off linesize 100 trimspool on define dir='/u01/open_backup' define fil='/u01/open_backup/open_backup_commands.sql' define spo='&dir/open_backup_output.lst' prompt *** Spooling to &fil set serveroutput on spool &fil prompt spool &spo prompt archive log list;; prompt alter system switch logfile;; DECLARE CURSOR cur_tablespace IS SELECT tablespace_name FROM dba_tablespaces WHERE status <> 'READ ONLY'; CURSOR cur_datafile (tn VARCHAR) IS SELECT file_name FROM dba_data_files WHERE tablespace_name=tn; BEGIN FOR ct IN cur_tablespace LOOP dbms_output.put_line('alter tablespace '||ct.tablespace_name ||' begin backup;'); FOR cd IN cur_datafile(ct.tablespace_name) LOOP dbms_output.put_line('host cp '||cd.file_name ||' &dir'); END LOOP; dbms_output.put_line('alter tablespace '||ct.tablespace_name||' end backup;'); END LOOP; END; 第 37 页 共 38 页 / prompt alter system switch logfile;; prompt alter database backup controlfile to '&dir/backup.ctl' REUSE;; prompt archive log list;; prompt spool off;; spool off; @&fil 经过测试,可以成功运行. 在数据库运行状态备份数据,运行 sqlplus>@/u01/open_backup.sql 即可 如果需要备份参数文件的话: 如: SQL> create pfile='/u01/open_backup/initorcl.ora' from spfile='/u01/app/oracle/product/10.2.0/db_1/dbs/spfileorcl.ora'; 创建归档文件脚本:archive_backup.sql 目录:/u01/open_backup/archive/目录下: 内容: define dir='/u01/open_backup/archive' define fil='/u01/open_backup/archive/archive_backup_commands.sql' spool &fil prompt archive log next;; select 'host mv '||name ||' &dir' from v$archived_log where completion_time>=trunc(sysdate)-1 and completion_time@/u01/open_backup/archive/archive_backup.sql 即可 把昨天的归档的所有日志移动到/u01/open_backup/archive/目录下 第 38 页 共 38 页
还剩37页未读

继续阅读

下载pdf到电脑,查找使用更方便

pdf的实际排版效果,会与网站的显示效果略有不同!!

需要 20 金币 [ 分享pdf获得金币 ] 2 人已下载

下载pdf

pdf贡献者

edwardking

贡献于2010-11-03

下载需要 20 金币 [金币充值 ]
亲,您也可以通过 分享原创pdf 来获得金币奖励!
下载pdf