1.硬件及操作系统平台(P6 570):
[root@oracle /]# prtconf | grep Type Processor Type: PowerPC_POWER6 CPU Type: 64-bit Kernel Type: 64-bit [root@oracle /]# oslevel -s 7100-02-02-1316
数据库版本11.2.0.3.0
2.系统中存在一个datavg卷组,用来存放数据数据,创建数据库所需要的裸设备:
[root@oracle /]# mklv -T O -y ctl1 datavg 30M ctl1 [root@oracle /]# mklv -T O -y ctl2 datavg 30M ctl2 [root@oracle /]# mklv -T O -y ctl3 datavg 30M ctl3 [root@oracle /]# mklv -T O -y redo01 datavg 100M redo01 [root@oracle /]# mklv -T O -y redo02 datavg 100M redo02 [root@oracle /]# mklv -T O -y redo03 datavg 100M redo03 [root@oracle /]# mklv -T O -y sysaux01 datavg 500M sysaux01 [root@oracle /]# mklv -T O -y system01 datavg 1G system01 [root@oracle /]# mklv -T O -y undotbs01 datavg 500M undotbs01 [root@oracle /]# mklv -T O -y users01 datavg 800M users01 [root@oracle /]# mklv -T O -y example01 datavg 300M example01 [root@oracle /]# mklv -T O -y temp01 datavg 400M temp01 [root@oracle /]# mklv -T O -y spfileyd datavg 10M spfileyd [root@oracle /]# mklv -T O -y pwdyd datavg 10M pwdyd
以root用户身份执行上述命令创建裸设备。创建完成后,检查datavg上裸设备的创建情况;
[root@oracle /]# lsvg -l datavg
datavg:
LV NAME TYPE LPs PPs PVs LV STATE MOUNT POINT
oralv jfs2 200 200 1 closed/syncd N/A
lv_u01 jfs2 200 200 1 open/syncd /u01
loglv00 jfs2log 1 1 1 open/syncd N/A
ctl1 jfs 1 1 1 open/syncd N/A
ctl2 jfs 1 1 1 open/syncd N/A
ctl3 jfs 1 1 1 open/syncd N/A
redo01 jfs 1 1 1 open/syncd N/A
redo02 jfs 1 1 1 open/syncd N/A
redo03 jfs 1 1 1 open/syncd N/A
sysaux01 jfs 1 1 1 open/syncd N/A
system01 jfs 2 2 1 open/syncd N/A
undotbs01 jfs 1 1 1 open/syncd N/A
users01 jfs 2 2 1 open/syncd N/A
example01 jfs 1 1 1 closed/syncd N/A
temp01 jfs 1 1 1 open/syncd N/A
spfileyd jfs 1 1 1 closed/syncd N/A
pwdyd jfs 1 1 1 closed/syncd N/A
使用下面的命令将上述裸设备的属主设置为oracle用户,并进行读写权限的更改:
chown oracle:oinstall /dev/rredo*
chown oracle:oinstall /dev/rctl*
......
chmod 755 /dev/rctl*
chmod 755 /dev/rredo*
.......
创建pfile文件:
[oracle@oracle dbs]$cat initCRM.ora
CRM.__db_cache_size=8254390272
CRM.__java_pool_size=33554432
CRM.__large_pool_size=33554432
CRM.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
CRM.__pga_aggregate_target=3288334336
CRM.__sga_target=9865003008
CRM.__shared_io_pool_size=0
CRM.__shared_pool_size=1476395008
CRM.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/CRM/adump'--需要创建这个目录
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/dev/rctl1','/dev/rctl2','/dev/rctl3'
*.db_block_size=8192
*.db_domain=''
*.db_name='CRM'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4322230272
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=CRMXDB)'
*.open_cursors=300
*.pga_aggregate_target=3288334336
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=9865003008
*.undo_tablespace='UNDOTBS1'
编写创建数据库的脚本:(/home/oracle/createdb.txt)
CREATE DATABASE CRM USER SYS IDENTIFIED BY 123123 USER SYSTEM IDENTIFIED BY 123123 LOGFILE GROUP 1 ('/dev/rredo01') SIZE 100M REUSE, GROUP 2 ('/dev/rredo02') SIZE 100M REUSE, GROUP 3 ('/dev/rredo03') SIZE 100M REUSE MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 100 CHARACTER SET AL32UTF8 NATIONAL CHARACTER SET AL16UTF16 EXTENT MANAGEMENT LOCAL DATAFILE '/dev/rsystem01' SIZE 1000M REUSE SYSAUX DATAFILE '/dev/rsysaux01' SIZE 450M REUSE -- 注意:size大小要比实际裸设备小一点。 DEFAULT TABLESPACE users DATAFILE '/dev/rusers01' SIZE 750M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED DEFAULT TEMPORARY TABLESPACE tempts1 TEMPFILE '/dev/rtemp01' SIZE 350M REUSE UNDO TABLESPACE undotbs1 DATAFILE '/dev/rundotbs01' SIZE 450M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
手动创建数据库CRM:
[oracle@oracle ~]$sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Mon Feb 2 14:16:08 2015
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 9820950528 bytes
Fixed Size 2229864 bytes
Variable Size 1543506328 bytes
Database Buffers 8254390272 bytes
Redo Buffers 20824064 bytes
SQL> @/home/oracle/createdb.txt;
Database created.
创建spfile文件到裸设备上:
SQL> create spfile='/dev/rspfileyd' from pfile;
File created.
检查数据库的数据文件:
SQL> select name from v$datafile;
NAME
--------------------------------------------------------------------------------
/dev/rsystem01
/dev/rsysaux01
/dev/rundotbs01
/dev/rusers01
SQL> select name from v$controlfile;
NAME
--------------------------------------------------------------------------------
/dev/rctl1
/dev/rctl2
/dev/rctl3
SQL> select member from v$logfile;
MEMBER
--------------------------------------------------------------------------------
/dev/rredo01
/dev/rredo02
/dev/rredo03
运行数据字典脚本,其中catalog和catproc是必需的,其它可选:
SQL> spool /home/oracle/cat_rawdb.log
SQL> @?/rdbms/admin/catalog.sql ; (建数据字典视图)
SQL> @?/rdbms/admin/catproc.sql ; (建存储过程包)
SQL> @?/rdbms/admin/catblock.sql ; (建锁相关的几个视图)
SQL> @?/rdbms/admin/catoctk.sql ; (建密码工具包dbms_crypto_toolkit)
SQL> @?/rdbms/admin/owminst.plb ; (建工作空间管理相关对象,如dmbs_wm)
SQL> spool off
执行完后检查/orahome/cat.log看看有什么不可接受的错误没有。
9.顺序重新编译所有对象:
数据库升级后,很多数据过程和包失效了,不执行这个就在执行的时候编译,会影响响应时间。
巡检的时候看具体情况是否需要重新编译
SQL> execute utl_recomp.recomp_serial();