AIX使用oracle

AIX系统,oracle11g

当前系统安装情况:
oracle用户: oracle
home目录: /home/oracle/
oracle ORACLE_HOME: /oracle/db/dbhome
oracle ORACLE_BASE: /oracle/db/dbbase
oracle安装目录: /oracle 大小50G (本地)
oracle数据存放目录: /oradata  大小 120G(本地)
oracle自动启动/停止脚本:
1.修改/etc/oratab,将“N”改为“Y”,使之支持开机启动
2.在/home/oracle目录下,创建dbstart.sh
3.在/etc下建立文件rc.startdb
#vi /etc/rc.startdb //以root用户进行创建,避免报错?
su – oracle -c “/home/oracle/dbstart.sh” #startOracleDB
4.给文件执行权限
#chmod 777 rc.startdb
5.添加自启动任务至/etc/inittab
$vi /etc/inittab
startdb:2:wait:/etc/rc.startdb>/home/oracle/oracle.log2>&1
注:也可以用命令mkitab添加
创建关闭脚本
1.在/etc下建立脚本文件rc.stopdb
  su – oracle -c “/home/oracle/dbstop.sh”
  给执行权限
2.编辑/etc/rc.shutdown文件
  添加内容如下
  rc.stopdb
  给执行权限
dbstart.sh脚本:
echo “Start Oracle DataBase Begin”
export ORACLE_SID=orcl
sqlplus /nolog <<EOF
connect / as sysdba
startup
quit
EOF
sleep 5
lsnrctl start
echo “Start Oracle DataBase End”
 
dbstop.sh脚本:
echo “Stop Oracle DataBase Begin”
lsnrctl stop
sleep 5
sqlplus /nolog <<EOF
connect /as sysdba
show sga;
shutdown immediate;
exit;
EOF
echo “Stop Oracle DataBase End”
rc.startdb脚本:
su – oracle -c “/home/oracle/dbstart.sh”
注:前面oracle为系统用户名
 
rc.stopdb脚本:
su – oracle -c “/home/oracle/dbstop.sh”
注:前面oracle为系统用户名
=====================
常用命令:
windows下:
telnet ip
例如:telnet 10.217.200.121
回车后按提示输入用户名密码登录
unix下:
查看oracle相关进程:ps -ef |grep ora
启动/停止/查看监听:lsnrctl start/stop/status
切换账号:su – useraccount,例如:su – root
数据库启动与停止:使用sqlplus登录oracle,startup和shutdown immediate命令
机器关闭:shutdown -F
This entry was posted in Computer. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s