AIX上安装oracle10g:
建议将oracle软件装在本地磁盘,数据文件放在共享存储上
安装数据库需提前规划的工作:
DBCA 创建数据库时,如果勾了EM选项,则会检测监听。
1.调整文件系统大小
df -g
chfs -a size=nG /filesystem ------另外再增加nG用chfs -a size=+nG /filesystem命令;
若想将一个大的文件系统缩小(比如将一个20G的文件系统缩小为5G),可以用chfs -a size=5G /filesystem命令,这样就将20G文件系统缩为5G了;
2.创建数据库安装独立文件系统
创建独立的文件系统来安装oracle软件
smitty mklv
rootvg
oraclelv
smitty crfs
/oracle
创建vg来存放数据文件
smitty mkvg
datavg
smitty datalv
smitty crfs
/data
/u01
/u02
3. 查看内存
[aix201:root:/]/usr/sbin/lsattr -E -l sys0 -a realmem
realmem 4194304 Amount of usable physical memory in Kbytes False
4. 查看交换区大小(paging space)
[aix201:root:/]/usr/sbin/lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum
hd6 hdisk0 rootvg 6912MB 1 yes yes lv 0
调整交换区大小(chps):smitty chps
lsps -a
交换区大小根据内存大小而定,当内存为1G至2G时,交换区为内存的1.5倍;当内存大小为2G至8G时,交换区大小等于内存大小;当内存大小为8G以上时,交换区为内存的0.75倍(这是10g的需求);
交换区大小根据内存大小而定,当内存为1G至2G时,交换区为内存的1.5倍;当内存大小为2G至16G时,交换区大小等于内存大小;当内存大小为16G以上时,交换区大小就设为16G(这是11g的需求)
5.确认系统是32位的还是64位的:/usr/bin/getconf HARDWARE_BITMODE
6.确定系统版本:oslevel -r或oslevel -s
7. 查看需要安装软件包
lslpp-l bos.adt.base bos.adt.lib bos.adt.libm bos.perf.perfstat bos.perf.libperfstat bos.perf.proctools
[aix201:root:/]os.adt.libm bos.perf.perfstat bos.perf.libperfstat bos.perf.proctools <
Fileset Level State Description
----------------------------------------------------------------------------
Path: /usr/lib/objrepos
bos.adt.base 6.1.6.16 COMMITTED Base Application Development
Toolkit
bos.adt.lib 6.1.2.0 COMMITTED Base Application Development
Libraries
bos.adt.libm 6.1.6.0 COMMITTED Base Application Development
Math Library
bos.perf.libperfstat 6.1.6.16 COMMITTED Performance Statistics Library
Interface
bos.perf.perfstat 6.1.6.16 COMMITTED Performance Statistics
Interface
bos.perf.proctools 6.1.6.16 COMMITTED Proc Filesystem Tools
Path: /etc/objrepos
bos.adt.base 6.1.6.16 COMMITTED Base Application Development
Toolkit
bos.perf.libperfstat 6.1.6.16 COMMITTED Performance Statistics Library
Interface
bos.perf.perfstat 6.1.1.0 COMMITTED Performance Statistics
Interface
[aix201:root:/]lslpp -l | grep xlC
xlC.aix61.rte 11.1.0.1 COMMITTED XL C/C++ Runtime for AIX 6.1
xlC.cpp 9.0.0.0 COMMITTED C for AIX Preprocessor
xlC.msg.en_US.cpp 9.0.0.0 COMMITTED C for AIX Preprocessor
xlC.msg.en_US.rte 11.1.0.1 COMMITTED XL C/C++ Runtime
xlC.rte 11.1.0.1 COMMITTED XL C/C++ Runtime
xlC.sup.aix50.rte 9.0.0.1 COMMITTED XL C/C++ Runtime for AIX 5.2
[aix201:root:/]
8. 查看补丁
# /usr/sbin/instfix -i -k "IY63133 IY64978 IY63366 IY64691 IY65001 IY64737 IY64361 IY65305 IY58350 IY63533"
9.确定主机名(hostname),域名(domainname),hosts文件(/etc/hosts)
10. Installing on Multihomed Computers ---多ip多网络时需要用到的
11.建组和用户:oinstall和dba组,oracle用户
mkgroup -'A' id='1000' adms='root' oinstall
mkgroup -'A' id='1200' adms='root' dba
mkuser id='1100' pgrp='oinstall' groups='dba' home='/home/oracle' fsize=-1 cpu=-1 data=-1 rss=-1 stack=-1 stack_hard=-1 oracle
---可进入smitty user 与 smitty group里设置
给oracle用户设置密码:passwd oracle,然后登录测试
oracle升级时需要oraInventory目录,此目录不能随意删除
12.修改系统对文件大小的限制:vi /etc/security/limits,就是将default参数全改成-1,重新登录生效(也可以在建用户的时候改),用ulimits -a查看修改后的参数;
13.改变系统参数:smitty chgsys将每个用户允许的最大进程数改为16384
或用命令改:chdev -l sys0 -a maxuproc='16384'
chdev -l sys0 -a ncargs=256
14.创建目录结构
mkdir -p /oracle/app/oracle/product/10.2/db_1
chown -R oracle.oinstall /oracle/app
chmod -R 775 /oracle/app
15.上传安装介质并解压,注意改成oracle所有
解压gz文件用gunzip *.gz即可
file 文件名 ---可以查看文件是什么类型的文件
cpio文件解压:cpio -idcmv < *.cpio
zip文件解压:unzip *.zip
16.设置环境变量(安装完设置也可以)
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ ORACLE_BASE/product/10.2/db_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
17. 修改图形环境变量设置:字符界面设置了环境变量后在图形界面调用不了,此时需要编辑$HOME/.dtprofile里的#DTSOURCEPROFILE=true,将注释去掉即可;
注意:如果图形终端登录不正常
1.编辑/etc/hosts
文本里必须有IP地址和主机名的对应关系
127.0.0.1 行不能删除,而且此行不能有主机名出现
cat /etc/hosts
127.0.0.1 loopback localhost # loopback (lo0) name/address
192.168.1.201 aix201
2.查看oracle用户home目录,核对权限
18. root 跑rootpre:在执行安装前必须用root用户执行下rootpre目录下的rootpre.sh脚本,即./rootpre.sh,然后再执行安装;
19. oracle用户进行安装,图形终端:另有时由于安装oracle不支持系统的版本时,可在安装时忽略版本检测,加个参数:即./runInstaller -ignoreSysPrereqs,不需要改版本号,这和linux改版本号不同
如果安装过程出错可查看vi /etc/oraI*文件,编辑里面的路径,改为$ORACLE_HOME(家目录),然后再试试;
oracle升级,软件和库都要升级,先升级软件再建库,这样建的库就是新的库,否则在安装软件时同时建库,后面升级时软件和库都要升级,比较麻烦;
---rmuser -p oracle ---删除oracle用户
---进入oracle家目录删除oracle文件夹:rm -rf oracle
aix上删除oracle10g
查看实例有没启动:ps -ef|grep smon
有无oracle进程启动:ps -ef|grep ora
删除软件:
删除oracle用户rm -rf /oracle
删除家目录下的用户目录:/home/oracle
/tmp下删除:rm -rf /tmp/.oracle,rm -rf /tmp/ora*
rm -rf /var/tmp/ora*
rm -rf /etc/ora*
注意:删除用户时,不仅要删除用户名也要删除/home目录下以用户名命名的文件夹;
oracle软件升级
软件安装完后就可以用oracle用户升级软件了,解压升级包
还是执行./runInstaller,选择n
会提示使用root用户执行:slibclean命令,然后再执行./runInstaller就进入了软件升级界面;
root用户执行root.sh脚本
[aix201:root:/oracle/software]/oracle/app/oracle/product/10.2/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME=/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) [n]: y
Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y
Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y
Copying coraenv to /usr/local/bin ...
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.
在存储上建库:
存储划分,mapping给主机放数据文件
在主机上创建vg--lv--fs--mount
创建vg:smitty mkvg
vg名为datavg
创建lv:smitty mklv
lv名为datalv
在datalv上创建文件系统:smitty crfs
创建好的文件系统挂载到:/u01
改变挂载点的属主与属组:
[aix201:root:/]chown -R oracle.oinstall /u01
[aix201:root:/]chmod -R 775 /u01
DBCA 建库,oracle用户在图形终端执行:dbca
软件升级后建库时要选custom database,否则就白升级了,建完库还要升级库;
---软件升级完后就建库了,用DBCA建库,oracle用户图形终端执行
---默认oracle的库会建在/oracle/app/oracle目录下
生产库上闪回一般都不开,闪回是做测试用的;
10g数据库安装时要先安装基础版本10201,然后升级到相应的高版本,不能直接安装高版本,11g没有这个要求,随便安装哪个版本都行;
10g的sga实现了自动管理,pga还不能自动管理,11g的pga和sga都实现了自动管理;
创建监听(有两种方法:netca和netmgr):
netca
$ netca
Oracle Net Services Configuration:
Configuring Listener:LISTENER
Default local naming configuration complete.
Listener configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/oracle/app/oracle/product/10.2/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Oracle Net Services configuration successful. The exit code is 0
netmgr:创建完监听后,连接 数据库注册下监听:alter system register
$netmgr
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = aix201)(PORT = 1521))
)
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Mar 27 15:15:32 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter system register;
System altered.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$ lsnrctl status ---查看监听状态,若监听是默认名则不需加监听名,否则要加监听名,如lsnrctl status listener1
LSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Production on 27-MAR-2013 15:16:02
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=aix201)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Production
Start Date 27-MAR-2013 15:14:50
Uptime 0 days 0 hr. 1 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP ON
Listener Parameter File /oracle/app/oracle/product/10.2/db_1/network/admin/listener.ora
Listener Log File /oracle/app/oracle/product/10.2/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aix201)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
---监听状态里出现ready的是动态注册监听,出现unknown的是静态注册;
删除监听:在$ORACLE_HOME/network/admin目录下删除listener.ora和tnsnames.ora文件即可,即rm listen*和rm tnsname*
cd - //回到上一次的目录
裸设备建库:
裸设备只能存放一个数据文件,有多少数据文件就需要建多少裸设备;
新建vg
smitty mkvg
新建名为oravg的vg
pp为256M
新建lv
mklv -y ora_system01 -T O -w n -t raw -s n -r n oravg 12 ---只关注红色字体部分
mklv -y ora_sysaux01 -T O -w n -t raw -s n -r n oravg 12
mklv -y ora_undotbs01 -T O -w n -t raw -s n -r n oravg 16
mklv -y ora_temp01 -T O -w n -t raw -s n -r n oravg 16
mklv -y ora_users01 -T O -w n -t raw -s n -r n oravg 4
mklv -y ora_redo01 -T O -w n -t raw -s n -r n oravg 2
mklv -y ora_redo02 -T O -w n -t raw -s n -r n oravg 2
mklv -y ora_redo03 -T O -w n -t raw -s n -r n oravg 2
mklv -y ora_control01 -T O -w n -t raw -s n -r n oravg 1
mklv -y ora_control02 -T O -w n -t raw -s n -r n oravg 1
mklv -y ora_control03 -T O -w n -t raw -s n -r n oravg 1
mklv -y ora_spfile -T O -w n -t raw -s n -r n oravg 1
以上是命令方式,也可以用smitty mklv命令建;
ls -l ora_*
ls -l rora_*
chown oracle.oinstall rora_*
chmod 660 rora_*
[aix201:root:/dev]ls -l rora_*
crw-rw---- 1 oracle oinstall 39, 9 Mar 27 15:44 rora_control01
crw-rw---- 1 oracle oinstall 39, 10 Mar 27 15:44 rora_control02
crw-rw---- 1 oracle oinstall 39, 11 Mar 27 15:44 rora_control03
crw-rw---- 1 oracle oinstall 39, 6 Mar 27 15:44 rora_redo01
crw-rw---- 1 oracle oinstall 39, 7 Mar 27 15:44 rora_redo02
crw-rw---- 1 oracle oinstall 39, 8 Mar 27 15:44 rora_redo03
crw-rw---- 1 oracle oinstall 39, 12 Mar 27 15:44 rora_spfile
crw-rw---- 1 oracle oinstall 39, 2 Mar 27 15:43 rora_sysaux01
crw-rw---- 1 oracle oinstall 39, 1 Mar 27 15:43 rora_system01
crw-rw---- 1 oracle oinstall 39, 4 Mar 27 15:44 rora_temp01
crw-rw---- 1 oracle oinstall 39, 3 Mar 27 15:43 rora_undotbs01
crw-rw---- 1 oracle oinstall 39, 5 Mar 27 15:44 rora_users01
在弹出的界面上设置路径和在裸设备上的文件名
路径:/dev/,文件名:rora_control01
依次将控制文件,重做数据文件,表空间等里的路径和文件名设置好;
裸设备建库需要建的数据文件、控制文件、参数文件和密码文件:
system=/dev/rora1_system01
sysaux=/dev/rora1_sysaux01
undotbs1=/dev/rora1_undotbs01
users=/dev/rora1_users01
temp=/dev/rora1_temp01
redo1_1=/dev/rora1_redo01
redo1_2=/dev/rora1_redo02
redo1_3=/dev/rora1_redo03
control1=/dev/rora1_control01
control2=/dev/rora1_control02
control3=/dev/rora1_control03
spfile=/dev/rora1_spfile
pwdfile=/dev/rora1_pwdfile
裸设备建库需要建的参数文件内容:
rawdb.__db_cache_size=348127232
rawdb.__java_pool_size=4194304
rawdb.__large_pool_size=4194304
rawdb.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
rawdb.__pga_aggregate_target=343932928
rawdb.__sga_target=515899392
rawdb.__shared_io_pool_size=0
rawdb.__shared_pool_size=150994944
rawdb.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/rawdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/dev/rora1_control01','/dev/rora1_control02','/dev/rora1_control03'
*.db_block_size=8192
*.db_domain=''
*.db_name='rawdb'
*.diagnostic_dest='/u01/app/oracle'
*.memory_target=858783744
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS01'
-----ASM可以加裸盘,高端存储一般只用4块盘,同一个raid中多划出一个lun就会多一次 IO;oracle 11.2RAC就不支持HA了;
裸设备建lv会生成两种类型的文件:b---建文件系统用,c----建裸设备用;先建lv再给权限,再建表空间:create tablespace test datafile '/dev/rtest_lv' size 10M;
rmlv -f test_lv
cd /dev:ls -l *disk* ----查看裸盘,建了lv的才叫裸设备;
AIX系统启动时会先找/home/用户名/.profile文件,若找不到就会去找/etc/profile文件;
AIX上安装oracle11g
---安装完操作系统,再安装appdev,server,cde,ssh等boundles(smitty installp),最后再 升级系统(smitty update_all);
tar包只能root用户来解压:
tar -zxvf database.tar.gz ---.gz解压时要用-zxvf来解压
tar -xvf database.tar ---tar包直接用-xvf来解压
给文件打包:tar -cvf test.tar test ---打包时要压缩的话,要用-zcvf参数
查看tar包内容:tar -tvf test.tar
1. 安装操作系统
2. 安装appdev server cde ssh
3. update os
4. 调整文件系统大小
df -g
chfs -a size=nG /filesystem
5. 创建数据库安装独立文件系统
smitty mklv
rootvg
oraclelv
smitty crfs
/oracle
smitty mkvg
datavg
smitty datalv
smitty crfs
/data
/u01
/u02
6. 查看内存
[aix201:root:/]/usr/sbin/lsattr -E -l sys0 -a realmem
realmem 4194304 Amount of usable physical memory in Kbytes False
7. 查看paging space
[aix201:root:/]/usr/sbin/lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum
hd6 hdisk0 rootvg 6912MB 1 yes yes lv 0
调整:smitty chps
[aix201:root:/]lsps -a
Page Space Physical Volume Volume Group Size %Used Active Auto Type Chksum
hd6 hdisk0 rootvg 8192MB 1 yes yes lv 0
8. 确认系统32位还是64位
[aix201:root:/]/usr/bin/getconf HARDWARE_BITMODE
64
ls -l /unix
unix -> /usr/lib/boot/unix_64
bootinfo -K
64
9. 查看系统版本
oslevel -r
oslevel -s
7. 查看需要安装软件包
lslpp -l bos.adt.base bos.adt.lib bos.adt.libm bos.perf.perfstat bos.perf.libperfstat bos.perf.proctools
smitty installp
安装基础包可能导致系统版本降低,需要再次升级
smitty update_all
[aix201:root:/]os.adt.libm bos.perf.perfstat bos.perf.libperfstat bos.perf.proctools <
Fileset Level State Description
----------------------------------------------------------------------------
Path: /usr/lib/objrepos
bos.adt.base 6.1.6.16 COMMITTED Base Application Development
Toolkit
bos.adt.lib 6.1.2.0 COMMITTED Base Application Development
Libraries
bos.adt.libm 6.1.6.0 COMMITTED Base Application Development
Math Library
bos.perf.libperfstat 6.1.6.16 COMMITTED Performance Statistics Library
Interface
bos.perf.perfstat 6.1.6.16 COMMITTED Performance Statistics
Interface
bos.perf.proctools 6.1.6.16 COMMITTED Proc Filesystem Tools
Path: /etc/objrepos
bos.adt.base 6.1.6.16 COMMITTED Base Application Development
Toolkit
bos.perf.libperfstat 6.1.6.16 COMMITTED Performance Statistics Library
Interface
bos.perf.perfstat 6.1.1.0 COMMITTED Performance Statistics
Interface
[aix201:root:/]lslpp -l | grep xlC
xlC.aix61.rte 11.1.0.1 COMMITTED XL C/C++ Runtime for AIX 6.1
xlC.cpp 9.0.0.0 COMMITTED C for AIX Preprocessor
xlC.msg.en_US.cpp 9.0.0.0 COMMITTED C for AIX Preprocessor
xlC.msg.en_US.rte 11.1.0.1 COMMITTED XL C/C++ Runtime
xlC.rte 11.1.0.1 COMMITTED XL C/C++ Runtime
xlC.sup.aix50.rte 9.0.0.1 COMMITTED XL C/C++ Runtime for AIX 5.2
[aix201:root:/]
8. 查看补丁
# /usr/sbin/instfix -i -k "IY63133 IY64978 IY63366 IY64691 IY65001 IY64737 IY64361 IY65305 IY58350 IY63533"
9. 确认主机名,域名,hosts文件
hostname
domainname
/etc/hosts
10. Installing on Multihomed Computers
Bourne, Bash, or Korn shell:
$ ORACLE_HOSTNAME=somehost.us.acme.com
$ export ORACLE_HOSTNAME
11. 用户和组
oinstall
dba
oracle
mkgroup -'A' id='1000' oinstall
mkgroup -'A' id='1200' dba
mkuser id='1100' pgrp='oinstall' groups='dba' fsize='-1' data='-1' stack='-1' core='-1' rss='-1' nofiles='-1' oracle
passwd oracle,登录测试,否则用户家目录下没有.dtprofile文件,重新登录图形界面测试就会有了;
12. 改限制
[aix_204:root:/]vi /etc/security/limits
default:
fsize = 2097151
core = 2097151
cpu = -1
data = 262144
rss = 65536
stack = 65536
nofiles = 2000
改:
default:
fsize = -1
core = -1
cpu = -1
data = -1
rss = -1
stack = -1
nofiles = -1
注意:改完后重新登录
[aix_204:root:/]ulimit -a
time(seconds) unlimited
file(blocks) unlimited
data(kbytes) unlimited
stack(kbytes) 4194304
memory(kbytes) unlimited
coredump(blocks) unlimited
nofiles(descriptors) unlimited
threads(per process) unlimited
processes(per user) unlimited
13. 改变系统参数
smit chgsys
chdev -l sys0 -a maxuproc='16384'
chdev -l sys0 -a ncargs=256
14. 创建目录结构
mkdir -p /oracle/app/oracle/product/11.2/db_1
chown -R oracle.oinstall /oracle/app
chmod -R 775 /oracle/app
15. 上传安装介质并解压,注意改成oracle所有
tar -xvf database.tar
16. 设置环境变量
export ORACLE_BASE=/oracle/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2/db_1
export ORACLE_SID=orcl
export PATH=$ORACLE_HOME/bin:$PATH
17. 修改图形环境变量设置
vi $HOME/.dtprofile
# DTSOURCEPROFILE=true
改:去掉注释,否则profile不能生效;
DTSOURCEPROFILE=true
注意:如果图形终端登录不正常
a.编辑/etc/hosts
必须有IP地址和主机名的对应关系
127.0.0.1 行不能删除,而且此行不能有主机名出现
cat /etc/hosts
127.0.0.1 loopback localhost # loopback (lo0) name/address
192.168.1.201 aix201
b.查看oracle用户home目录,核对权限
18. root 跑rootpre
[aix201:root:/oracle/software/Disk1]cd rootpre
[aix201:root:/oracle/software/Disk1/rootpre]ls
ORCLcluster loadext pw-syscall pw-syscall32 pw-syscall64 rootpre.sh
[aix201:root:/oracle/software/Disk1/rootpre]./rootpre.sh
./rootpre.sh output will be logged in /tmp/rootpre.out_13-03-27.11:24:00
Saving the original files in /etc/ora_save_13-03-27.11:24:00....
Copying new kernel extension to /etc....
Loading the kernel extension from /etc
Oracle Kernel Extension Loader for AIX
Copyright (c) 1998,1999 Oracle Corporation
Successfully loaded /etc/pw-syscall.64bit_kernel with kmid: 0x50a1c000
Successfully configured /etc/pw-syscall.64bit_kernel with kmid: 0x50a1c000
The kernel extension was successfuly loaded.
Configuring Asynchronous I/O....
Asynchronous I/O is not installed on this system.
You will need to install it, and either configure it yourself using
'smit aio' or rerun the Oracle root installation procedure.
Configuring POSIX Asynchronous I/O....
Posix Asynchronous I/O is not installed on this system.
You will need to install it, and either configure it yourself using
'smit aio' or rerun the Oracle root installation procedure.
Checking if group services should be configured....
Nothing to configure.
19. oracle用户进行安装,图形终端
./runInstaller-ignoreSysPrereqs
For ignoring the results of the system pre-requisite checks.
执行root脚本
[aix201:root:/oracle/app/oracle/oraInventory]./orainstRoot.sh
Changing permissions of /oracle/app/oracle/oraInventory to 775.
Changing groupname of /oracle/app/oracle/oraInventory to oinstall.
[aix201:root:/]/oracle/app/oracle/product/10.2/db_1/root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/app/oracle/product/10.2/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Creating /usr/local/bin directory...
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.
20. root用户执行
#slibclean
21. oracle用户升级软件
./runInstaller
22. root用户执行root.sh脚本
[aix201:root:/oracle/app]cd oraI*
[aix201:root:/oracle/app/oraInventory]ls
ContentsXML oraInst.loc oui
install.platform oraInstaller.properties
logs orainstRoot.sh
[aix201:root:/oracle/app/oraInventory]./orainstRoot.sh
Changing permissions of /oracle/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /oracle/app/oraInventory to oinstall.
The execution of the script is complete.
[aix201:root:/oracle/app/oraInventory]cd
[aix201:root:/]/oracle/app/oracle/product/11.2/db_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /oracle/app/oracle/product/11.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) [n]: y
Copying dbhome to /usr/local/bin ...
The file "oraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y
Copying oraenv to /usr/local/bin ...
The file "coraenv" already exists in /usr/local/bin. Overwrite it? (y/n) [n]: y
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.
Finished product-specific root actions.
23. 存储划分,mapping给主机放数据文件
主机创建vg--lv--fs--mount
smitty mkvg
datavg
smitty mklv
datalv
smitty crfs
/u01
[aix201:root:/]chown -R oracle.oinstall /u01
[aix201:root:/]chmod -R 775 /u01
24. DBCA 建库,oracle用户图形终端执行
dbca
25. 配置监听
$ netca
Oracle Net Services Configuration:
Configuring Listener:LISTENER
Default local naming configuration complete.
Listener configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/oracle/app/oracle/product/10.2/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Oracle Net Services configuration successful. The exit code is 0
$netmgr
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = aix201)(PORT = 1521))
)
$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Wed Mar 27 15:15:32 2013
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> alter system register;
System altered.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$ lsnrctl status
LSNRCTL for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Production on 27-MAR-2013 15:16:02
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=aix201)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Production
Start Date 27-MAR-2013 15:14:50
Uptime 0 days 0 hr. 1 min. 12 sec
Trace Level off
Security ON: Local OS Authentication
SNMP ON
Listener Parameter File /oracle/app/oracle/product/10.2/db_1/network/admin/listener.ora
Listener Log File /oracle/app/oracle/product/10.2/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=aix201)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orcl_XPT" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
#vncserver
#vncpasswd ---修改vnc密码
如果要连接另一个库时,先export ORACLE_SID=rawdb,转到另一个SID,查看一下echo $ORACLE_SID,然后用这个SID来连接库;
数据库打开的三个阶段:
nomount状态读取pfile,pfile里记录了:内存分配情况,dump信息和控制文件位置信息;
mount状态读取控制文件,控制文件记录了数据库的结构信息;
open状态:加载数据文件;
11g的告警日志文件和参数文件放在trace目录下
show parameter dump ---可以查看到trace的路径
alter database backup controlfile to trace;---将控制文件备份到trace,到trace目录下去找就可以了(老师有sql语句能查到备份的.trc,如下)
获取trace文件路径
select c.value || '/' || d.instance_name || '_ora_' || a.spid || '.trc' trace
from v$process a, v$session b, v$parameter c, v$instance d
where a.addr = b.paddr
and b.audsid = userenv('sessionid')
and c.name = 'user_dump_dest';
或者可以指定到对应目录:alter database backup controlfile to trace as '/home/control.ctl';
redo块的大小与操作系统块大小是一致的,与oracle数据块不相关;
手工实现11g在裸设备上建库
平台:IBM AIX 570
PP大小128M
mklv -y ora_system01 -T O -w n -t raw -s n -r n rootvg 4
mklv -y ora_sysaux01 -T O -w n -t raw -s n -r n rootvg 4
mklv -y ora_undotbs01 -T O -w n -t raw -s n -r n rootvg 2
mklv -y ora_temp01 -T O -w n -t raw -s n -r n rootvg 2
mklv -y ora_users01 -T O -w n -t raw -s n -r n rootvg 1
mklv -y ora_redo01 -T O -w n -t raw -s n -r n rootvg 1
mklv -y ora_redo02 -T O -w n -t raw -s n -r n rootvg 1
mklv -y ora_redo03 -T O -w n -t raw -s n -r n rootvg 1
mklv -y ora_control01 -T O -w n -t raw -s n -r n rootvg 1
mklv -y ora_control02 -T O -w n -t raw -s n -r n rootvg 1
mklv -y ora_control03 -T O -w n -t raw -s n -r n rootvg 1
mklv -y ora_spfile -T O -w n -t raw -s n -r n rootvg 1
chown oracle:oinstall /dev/rora_*
db_name = rawdb
1. 设置环境变量
每台主机都建
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=rawdb
export PATH=$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$PATH
2. 用oracle用户建立需要的目录
SQL> show parameter dump
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
background_core_dump string partial
background_dump_dest string /oracle/app/oracle/diag/rdbms/
orcl/orcl/trace
core_dump_dest string /oracle/app/oracle/diag/rdbms/
orcl/orcl/cdump
max_dump_file_size string unlimited
shadow_core_dump string partial
user_dump_dest string /oracle/app/oracle/diag/rdbms/
orcl/orcl/trace
adump 审计信息,放置审计文件
bdump 放置后台进程的trace文件和alert log ,就是说 alert_sid.log也存在这个目录中
cdump core dump 当数据库崩溃的时候,把内存结构生成dump,cdump有文件肯定是 大文件。一般是用来日志应用程序的除非数据库出了问题,否则基本上不会有什么信息
dpdump 存放一些登录信息
udump server process出问题的trace文件,前台手动trace的,比如sql trace之后session的trace文件
pfile 是个空文件,只有一句话,是指向spfile的(create spfile=/dev/rora_spfile from pfile)。真正的目录在$ORACLE_HOME/dbs
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/adump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/bdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/cdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/dpdump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/udump
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/pfile
mkdir -p $ORACLE_BASE/admin/$ORACLE_SID/scripts
chmod -R 755 $ORACLE_BASE/admin
---------------------------------------------
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/alert
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/cdump
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/hm
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/incident
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/incpkg
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/ir
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/lck
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/metadata
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/stage
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/sweep
mkdir -p $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace
chmod -R 755 $ORACLE_BASE/diag/rdbms/$ORACLE_SID
3. 建初始化参数文件
建一个pfile,pfile文件名为init<ORACLE_SID>.ora 即initrawdb.ora
$ cat initrawdb.ora
rawdb.__db_cache_size=348127232
rawdb.__java_pool_size=4194304
rawdb.__large_pool_size=4194304
rawdb.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
rawdb.__pga_aggregate_target=343932928
rawdb.__sga_target=515899392
rawdb.__shared_io_pool_size=0
rawdb.__shared_pool_size=150994944
rawdb.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/rawdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/dev/rora_control01','/dev/rora_control02','/dev/rora_control03'
*.db_block_size=8192
*.db_domain=''
*.db_name='rawdb'
*.diagnostic_dest='/u01/app/oracle'
*.memory_target=858783744
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS01'
create spfile from pfile
把spfile move 到存储上
本地的pfile(pfile内写的内容:$ORACLE_HOME/dbs/initraw.ora)指向spfile
#以下为建库必需参数
裸设备直接用设备的名字作为控制文件的名字
UNDOTBS1需要和建库的名字对应起来
db_name 跟db_unique_name一样就可以了
memory_target 给oracle60%,系统是64G内存如果按60%系统就生20+G没什么必要给系统那么多,可以提升到80%
open_cursors=1500,processes=1500 设大是为了做压力测试,以后可以调整
open_cursors 基本是每个session打开一个cursor,一个游标执行三次就放到session cached cursors,如果里面存了20个,oracle就认为打开了20个open_cursors
control_files=(/dev/rora_control01,/dev/rora_control02,/dev/rora_control03)
undo_management=AUTO
undo_tablespace=UNDOTBS1
db_name=rawdb
db_unique_name=rawdb
db_block_size=8192
memory_target=2500M
open_cursors=1500
processes=1500
4. 建立密码文件
sysdba权限可以开关数据库,dba没有权限开关数据库
sqlplus / as sysdba 操作系统认证,oracle用户属于dba组,系统认为有权限管理oracle
远程以sysdba登录过去,就需要使用这个密码文件。
$ orapwd file=$ORACLE_HOME/dbs/orapwrawdb password=oracle force=y entries=5
5. 建spfile后启动实例并开始建库
$ sqlplus '/as sysdba'
SQL> create spfile='/dev/rora_spfile' from pfile; (会自动读取pfile:$ORACLE_HOME/dbs/init$ORACLE_SID.ora)
vi pfile
spfile=/dev/rora_spfile
SQL> startup nomount
--建立了控制文件
--建立了空的表空间和数据文件
reuse如果有控制文件覆盖
控制文件里有物理结构,LRBA,控制文件里有归档日志的产生记录,历史信息,RMAN的元数据
MAXLOGHISTORY
数据文件的大小一定要小于裸设备,裸设备顺序读写,如果超出了这个,裸设备则会覆盖下一个裸设备。
oracle undo如果有问题就是空间问题,建议50G以上,以后也可以扩展大小,oracle需要跑批处理需要大量的undo
获取trace文件路径
select c.value || '/' || d.instance_name || '_ora_' || a.spid || '.trc' trace
from v$process a, v$session b, v$parameter c, v$instance d
where a.addr = b.paddr
and b.audsid = userenv('sessionid')
and c.name = 'user_dump_dest';
获取控制文件的trace
SQL> alter database backup controlfile to trace;
STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/u01/orcl/redo01.log' SIZE 50M BLOCKSIZE 512,
GROUP 2 '/u01/orcl/redo02.log' SIZE 50M BLOCKSIZE 512,
GROUP 3 '/u01/orcl/redo03.log' SIZE 50M BLOCKSIZE 512,
GROUP 4 '/u01/orcl/redo04.log' SIZE 50M BLOCKSIZE 512
-- STANDBY LOGFILE
DATAFILE
'/u01/orcl/system01.dbf',
'/u01/orcl/sysaux01.dbf',
'/u01/orcl/undotbs01.dbf',
'/u01/orcl/users01.dbf'
CHARACTER SET WE8MSWIN1252
;
-- Commands to re-create incarnation table
-- Below log names MUST be changed to existing filenames on
-- disk. Any one log file from each branch can be used to
-- re-create incarnation records.
-- ALTER DATABASE REGISTER LOGFILE '/oracle/app/oracle/product/11.2/db_1/dbs/arch1_1_81125
6261.dbf';
-- Recovery is required if any of the datafiles are restored backups,
-- or if the last shutdown was not normal or immediate.
RECOVER DATABASE USING BACKUP CONTROLFILE
-- Database can now be opened zeroing the online logs.
ALTER DATABASE OPEN RESETLOGS;
-- Commands to add tempfiles to temporary tablespaces.
-- Online tempfiles have complete space information.
-- Other tempfiles may require adjustment.
ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/orcl/temp01.dbf'
SIZE 52428800 REUSE AUTOEXTEND ON NEXT 655360 MAXSIZE 32767M;
-- End of tempfile additions.
rman target /
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
手工创建:
---手工建数据库文件;包含 日志文件、控制文件、数据文件;
SQL> create database rawdb CONTROLFILE REUSE
MAXINSTANCES 8
MAXDATAFILES 2000
MAXLOGHISTORY 1024
MAXLOGFILES 64
MAXLOGMEMBERS 4
character set ZHS16GBK national character set AL16UTF16
logfile group 1 ('/dev/rora_redo01') size 50M reuse,
group 2 ('/dev/rora_redo02') size 50M reuse,
group 3 ('/dev/rora_redo03') size 50M reuse
datafile '/dev/rora_system01' size 1000M reuse extent management local
sysaux datafile '/dev/rora_sysaux01' size 1000M
default temporary tablespace temp tempfile '/dev/rora_temp01' size 100M reuse
undo tablespace undotbs1 datafile '/dev/rora_undotbs01' size 100M reuse
USER SYS IDENTIFIED BY "oracle" USER SYSTEM IDENTIFIED BY "oracle";
6. 运行数据字典脚本,其中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看看有什么不可接受的错误没有。
7. 新建sqlplus属性和帮助、USERS表空间
SQL> connect system/oracle
SQL> @?/sqlplus/admin/pupbld.sql
SQL> @?/sqlplus/admin/help/hlpbld.sql helpus.sql
SQL> connect /as sysdba
SQL> CREATE TABLESPACE USERS LOGGING DATAFILE '/dev/rora_users01' SIZE 1000M EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;
SQL> ALTER DATABASE DEFAULT TABLESPACE USERS;
8. 最后修改为归档模式并重启(此步骤可省略)
SQL> archive log list;
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /oracle/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence 1
Current log sequence 2
SQL> shutdown immediate
SQL> connect /as sysdba
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
9.顺序重新编译所有对象:
数据库升级后,很多数据过程和包失效了,不执行这个就在执行的时候编译,会影响响应时间。
巡检的时候看具体情况是否需要重新编译
SQL> execute utl_recomp.recomp_serial();
10、建立和配置EM(省略此步骤):
dbconsole方式,也就是单机方式,在数据库里建立一堆跟em相关的对象
Grid Control方式,基于网络的远程管理方式
SQL>@?/sysman/admin/emdrep/sql/emreposcre /oracle/app/oracle/product/11.2.0/db_1 SYSMAN oracle TEMP ON;
SQL> alter user SYSMAN identified by "sysman" account unlock;
SQL> alter user DBSNMP identified by "dbsnmp" account unlock;
建监听的时候,注意在hostname和漂移ip都要
要建password文件,否则都会报错。
$ emca -config dbcontrol db----执行命令后提示:Database SID: orcl
$ emca -help----用作功能查询
------10g的EM配置;
SQL> host emca -config dbcontrol db -silent -DB_UNIQUE_NAME ypyhtb -PORT 1521 -EM_HOME /oracle/product/10.2/bin -LISTENER LISTENER -SERVICE_NAME ypythb -SYS_PWD "oracle" -SID ypythb -ORACLE_HOME /oracle/product/10.2 -DBSNMP_PWD "dbsnmp" -HOST "172.19.201.184" -LISTENER_OH /oracle/product/10.2 -LOG_FILE /oradata/ypythb/emConfig.log -SYSMAN_PWD "sysman";
------11g 的EM配置;
SQL> host emca -config dbcontrol db -silent -DB_UNIQUE_NAME bet -PORT 1521 -EM_HOME /oracle/app/oracle/product/11.2.0/db_1/bin -LISTENER LISTENER -SERVICE_NAME bet -SYS_PWD "oracle" -SID bet -ORACLE_HOME /oracle/app/oracle/product/11.2.0/db_1 -DBSNMP_PWD "dbsnmp" -HOST "192.168.1.215" -LISTENER_OH /oracle/app/oracle/product/11.2.0/db_1 -LOG_FILE /home/oracle/emConfig.log -SYSMAN_PWD "sysman";