Prework(下载oracle-10g-xe,添加用户)
1. Get the Oracle-10g-xe
2. add user*group
#!/bin/sh
# Usage: for add User and Group
echo "Now Check the available GroupID:"
expr `cut --delimiter=":" --fields=3 /etc/group | grep --regexp="^[5-9][0-9][0-9]$" | sort --numeric-sort|tail -1` + 1
echo "Input the GID as top:"
read UG_ID
groupadd -g $UG_ID dba
echo "We have add the Group!"
echo "Now Check the available UesrID:"
expr `cut --delimiter=":" --fields=3 /etc/passwd | grep --regexp="^[5-9][0-9][0-9]$" | sort --numeric-sort|tail -1` + 1`
echo "Input the UID as top:"
read US_ID
useradd -u $US_ID -g dba -d /usr/lib/oralce-xe -M oracle
echo "We have add the User!"
Install(安装)
rpm -ivh oracle*
If Oracle 10g Express Edition was just installed then configure it by executing
# /etc/init.d/oracle-xe configure
accept the default ports, provide a password for the SYS and SYSTEM, enter n when
prompted whether to start Oracle 10g Express Edition at boot.
OR, if this is an existing Oracle 10g Express Edition installation that is configured to start
at boot then disable automatic startup by executing:
# /etc/init.d/oracle-xe disable
Edit /etc/init.d/oracle-xe
By default, the oracle-xe script will start or stop the application only if it is enabled at boot.
Replace lines 597-628 in /etc/init.d/oracle-xe with the following:
case "$1" in
start)
start
;;
configure)
configure
;;
stop)
stop
;;
Start the Oracle database
Delete the automatic startup and shutdown scripts
# rm /etc/rc0.d/K??oracle-xe /etc/rc3.d/S??oracle-xe
Configure firewall
If the firewall is running, it must be configured to permit access to the listener and HTTP server ports defined in step 4. By default, these are ports 1521 and 8080 respectively. Insert the following before the COMMIT command in /etc/sysconfig/iptables.
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 1521 -j ACCEPT
Restart the firewall, by executing:
# /etc/init.d/iptables restart
Configure
1.Login as oracle
# su - oracle
2.Set the Oracle environment variables.
$ . $HOME/app/oracle/product/10.2.0/server/bin/oracle_env.sh
Append the command to ~/.bash_profile so that the environment variables are set
automatically.
3.Connect to the database as SYSDBA.
$ sqlplus "/ as sysdba"
4.Change the address of the default local listener to the virtual IP address (yourip).
SQL> ALTER SYSTEM
2 SET LOCAL_LISTENER='(ADDRESS = (PROTOCOL = TCP)
3 (HOST = yourip)(PORT = 1521))';
SQL> ALTER SYSTEM REGISTER;
5.(Optional) Allow remote access to the database server.
SQL> EXEC DBMS_XDB.SETLISTENERLOCALACCESS(FALSE);
6.(Optional) Enable the HR account and assign a password.
7.Create directory ~/app/oracle/admin/network for storage of listener configuration scripts.
$ mkdir ~/app/oracle/admin/network
8.Copy the contents of $ORACLE_HOME/network/admin to ~/app/oracle/admin
/network
$ cp -r $ORACLE_HOME/network/admin/* ~/app/oracle/admin/network
10.Configure the Oracle listener to use the virtual IP address
Replace the host name in line 16 of ~/app/oracle/admin/network/listener.ora with the virtual IP address (yourip) as shown:
(ADDRESS = (PROTOCOL = TCP)(HOST = yourip)(PORT = 1521))
Configure the database alias to point to the virtual IP address.
Replace the host name in line 5 of ~/app/oracle/admin/network/tnsname
with the virtual IP address as shown:
(ADDRESS = (PROTOCOL = TCP)(HOST = yourip)(PORT = 1521))
12.Copy the initialization parameter file - spfileXE.ora - and the password file - orap
from $ORACLE_HOME/dbs to ~/app/oracle/admin/XE/dbs.
$ cp $ORACLE_HOME/dbs/spfileXE.ora $ORACLE_HOME/dbs/orapwXE
> ~/app/oracle/admin/XE/dbs
13. Create $ORACLE_HOME/server/dbs/initXE.ora as follows:
SPFILE=/usr/lib/oracle/xe/app/oracle/admin/XE/dbs/spfileXE.ora
14. Create a symbolic link to ~/app/oracle/admin/XE/dbs/orapwXE.
$ rm $ORACLE_HOME/dbs/orapwXE
$ ln -s ~/app/oracle/admin/XE/dbs/orapwXE \
> ~/app/oracle/product/10.2.0/server/dbs/orapwXE
15. Logout the oracle user.
$ exit
16. Shut down Oracle 10g Express Edition
# /etc/init.d/oracle-xe stop
17. Append the following to etc/profile:
TNS_ADMIN=/usr/lib/oracle/xe/app/oracle/admin/network;export TNS_ADMIN
最后测试:
Good Luck!
FAQ-1
Q: TNS Ping Utility for Linux: Version 10.1.0.3.0 - Production on 09-MAR-2006 08:02:09
Copyright (c) 1997, 2003, Oracle. All rights reserved.
Message 3511 not found; No message file for product=network,
facility=TNSTNS-03505: Message 3505 not found; No message file for
product=network, facility=TNS
A: 检查环境变量 echo $ORACLE_HOME 如果没有 export ORACLE_HOME= /usr/lib/oracle/xe/app/oracle/product/10.2.0/server/
最好写到 .bashrc里去。
阅读(2107) | 评论(0) | 转发(0) |