Aix Oracle11g裸设备建库
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Aix Oracle11g裸设备建库相关的知识,希望对你有一定的参考价值。
11G RAW ON AIX
查看物理内存大小
/usr/sbin/lsattr -E -l sys0 -a realmem
Available RAM Swap Space Required
Between 1 GB and 2 GB 1.5 times the size of the RAM
Between 2 GB and 16 GB Equal to the size of the RAM
More than 16 GB 16 GB
查看paging space
/usr/sbin-/lsps a
修改paging space 大小(系统安装完成默认是512M)
smitty chps
查看系统是否为64-bit mode
bootinfo -K
getconf KERNEL_BITMODE
磁盘空间要求
/tmp 至少1GB
ORACLE软件需要的空间
企业版 7.51GB
标准版 7.07GB
数据文件需要的空间
企业版 1.75GB
标准版 1.73GB
操作系统运行级别
cat /etc/.init.state
level 2
操作系统版本要求
oslevel -s
AIX 5L V5.3 TL 09 SP1 ("5300-09-01"), 64 bit kernel
AIX 6.1 TL 02 SP1 ("6100-02-01), 64-bit kernel
AIX 7.1 TL 0 SP1 ("7100-00-01"), 64-bit kernel
软件包需求
The following operating system filesets are required for AIX 5L:
bos.adt.base
bos.adt.lib
bos.adt.libm
bos.perf.libperfstat 5.3.9.0 or later
bos.perf.perfstat
bos.perf.proctools
xlC.aix50.rte.10.1.0.0 or later
gpfs.base 3.2.1.8 or later
The following operating system filesets are required for AIX 6.1:
bos.adt.base
bos.adt.lib
bos.adt.libm
bos.perf.libperfstat 6.1.2.1 or later
bos.perf.perfstat
bos.perf.proctools
xlC.aix61.rte.10.1.0.0 or later
xlC.rte.10.1.0.0 or later
gpfs.base 3.2.1.8 or later
The following operating system filesets are required for AIX 7.1:
bos.adt.base
bos.adt.lib
bos.adt.libm
bos.perf.libperfstat
bos.perf.perfstat
bos.perf.proctools
xlC.aix61.rte:10.1.0.0 or later
xlC.rte.10.1.0.0 or later
gpfs.base 3.3.0.11 or later
查找安装包
lslpp -l bos.adt.base \
bos.adt.lib \
bos.adt.libm \
bos.perf.libperfstat \
bos.perf.perfstat \
bos.perf.proctools \
xlC.aix61.rte \
xlC.rte \
gpfs.base \
开发环境
IBM XL C/C++ Enterprise Edition for AIX
IBM XL C/C++ for AIX
补丁要求
AIX 5L V5.3 TL 09 SP1, and the following AIX fixes:
IZ42940
IZ49516
IZ52331
These 5.3 fixes are present in the following TL levels:
AIX 5.3 TL-09 SP-05 and later
AIX 5.3 TL-10 SP-02 and later
AIX 5.3 TL-11
Authorized Problem Analysis Reports (APARs) for AIX 6L:
If you are using the minimum operating system TL level for AIX 6L listed above,
then install all AIX 6L 6.1 Authorized Problem Analysis Reports (APARs) for AIX 6.1 TL 02 SP1,
and the following AIX fixes:
IZ41855
IZ51456
IZ52319
instfix -i | grep ML
/usr/sbin/instfix -i -k "IZ41855 IZ51456 IZ52319 IZ55274"
These 6.1 fixes are present in the following TL levels:
AIX 6.1 TL-02 SP-04 and later
AIX 6.1 TL-03 SP-02 and later
AIX 6.1 TL-04
Authorized Problem Analysis Reports (APARs) for AIX 7L:
If you are using the minimum operating system TL level for AIX 7.1 listed above,
then install all AIX 7L 7.1 Authorized Problem Analysis Reports (APARs) for AIX 7.1 TL 0 SP1,
and the following AIX fixes:
IZ87216
IZ87564
java 环境
Use JDK 6 (Java 6 64-bit 6.0.0.50 IZ30726 (SR2)) or
JDK 5 (Java 5 64-bit 5.0.0.250 IZ55274 (SR10))
查看网卡名称
lsdev -Cc adapter
查询网卡信息
entstat -d ent0
修改网卡属性
smit chgenet
检查用户显示界面的工作方式
smitty
System Environments > Change System User Interface
Select System Login User Interface Command Line
vmo -p -o minperm%=3
vmo -p -o maxperm%=90
vmo -p -o maxclient%=90
vmo -p -o lru_file_repage=0
vmo -p -o strict_maxclient=1
vmo -p -o strict_maxperm=0
ioo –p -o j2_inodeCacheSize=100
ioo –p -o j2_metadataCacheSize=100
/usr/sbin/no -r -o ipqmaxlen=512
/usr/sbin/no -p -o rfc1323=1
/usr/sbin/no -p -o sb_max=1310720
/usr/sbin/no -p -o tcp_recvspace=65536
/usr/sbin/no -p -o tcp_sendspace=65536
/usr/sbin/no -p -o udp_recvspace=655360
/usr/sbin/no -p -o udp_sendspace=65536
查看oinstall是否存在
查看文件
# more /etc/oraInst.loc
inventory_loc=/oracle/app/oraInventory
inst_group=oinstall
查看dba组用户
grep dba /etc/group
# mkdir -p /oracle/app/
# chown -R oracle:oinstall /oracle/app/
# chmod -R 775 /oracle/app/
mkdir -p /oracle/app/oracle
chown -R oracle:oinstall /oracle/app/oracle
chmod 775 /oracle/app/oracle
mkdir -p /oracle/app/oraInventory
chown -R oracle:oinstall /oracle/app/oraInventory
chmod 775 /oracle/app/oraInventory
$ su - oracle
. ./.profile
export ORACLE_BASE=/oracle/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
root用户执行
./rootpre.sh
oracle11g手工建库步骤
平台:IBM AIX 570
PP大小256M
mklv -y ora_system01 -T O -w n -t raw -s n -r n datavg 12
mklv -y ora_sysaux01 -T O -w n -t raw -s n -r n datavg 12
mklv -y ora_undotbs01 -T O -w n -t raw -s n -r n datavg 16
mklv -y ora_temp01 -T O -w n -t raw -s n -r n datavg 16
mklv -y ora_users01 -T O -w n -t raw -s n -r n datavg 4
mklv -y ora_redo01 -T O -w n -t raw -s n -r n datavg 2
mklv -y ora_redo02 -T O -w n -t raw -s n -r n datavg 2
mklv -y ora_redo03 -T O -w n -t raw -s n -r n datavg 2
mklv -y ora_control01 -T O -w n -t raw -s n -r n datavg 1
mklv -y ora_control02 -T O -w n -t raw -s n -r n datavg 1
mklv -y ora_control03 -T O -w n -t raw -s n -r n datavg 1
mklv -y ora_spfile -T O -w n -t raw -s n -r n oravg 1
chown oracle:oinstall /dev/rora_*
db_name = rawdb
1. 设置环境变量
每台主机都建
export ORACLE_BASE=/oracle/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的。真正的目录在$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=‘/oracle/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=‘/oracle/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=‘/oracle/app/oracle‘
*.memory_target=858783744
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile=‘EXCLUSIVE‘
*.undo_tablespace=‘UNDOTBS01‘
进入sqlplus / as sysdba执行create之前保证当前export的是裸设备库的环境变量(可手动执行
export ORACLE_SID=rawdb),否则仍然会查找原有的参数文件initorcl.ora,即:
export ORACLE_SID=rawdb
sqlplus / as sysdba
SQL>create spfile=‘/dev/rora_spfile‘ from pfile; 直接将spfile创建到存储上
把spfile move 到存储上
本地的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 ‘/oracle/orcl/redo01.log‘ SIZE 50M BLOCKSIZE 512,
GROUP 2 ‘/oracle/orcl/redo02.log‘ SIZE 50M BLOCKSIZE 512,
GROUP 3 ‘/oracle/orcl/redo03.log‘ SIZE 50M BLOCKSIZE 512,
GROUP 4 ‘/oracle/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
$ emca -help
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";
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";
到此建库完毕!
LISTENER =
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.203)(PORT=1521))
)
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=rawdb)
(SID_NAME=rawdb)
(ORACLE_HOME=/oracle/app/oracle/product/11.2.0/dbhome_1)
)
)
col PROPERTY_VALUE for a10
col DESCRIPTION for a40
select * from database_properties where property_name = ‘DEFAULT_PERMANENT_TABLESPACE‘;
以上是关于Aix Oracle11g裸设备建库的主要内容,如果未能解决你的问题,请参考以下文章