Linux 기초 명령어 (RedHat 계열)
- hostname 변경
# vi /etc/hostname
# vi /etc/sysconfig/network
# vi /etc/hosts
# service network restart
# reboot
- zip / unzip
$ zip -r test.zip ./*
$ unzip happy.zip
$ unzip happy.zip -d ./target
- tar.gz
$ tar -czvf images.tar.gz ./test
$ tar -xzvf images.tar.gz
- software update
# yum list updates
# yum update –y
Oracle Database 11g R2 installation
$ su -
# df -h
# usermod -g oinstall -G dba oracle
# useradd -g oinstall -G dba oracle
# passwd oracle
# /sbin/sysctl -p
# /sbin/sysctl -a
# mkdir -p /opt/app/
# chown -R oracle:oinstall /opt/app/
# chmod -R 775 /opt/app/
# su - oracle
$ export TMP=/tmp
$ export TMPDIR=$TMP
$ export ORACLE_BASE=/opt/app/oracle
$ export ORACLE_SID=orcl
After installation
# vi /etc/oratabSID:ORACLE_HOME:{Y|N|W} ----> Y
# vi /etc/init.d/oracle
#!/bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/opt/app/oracle/product/11.2.0/dbhome
ORACLE_USER=oracle
case "$1" in
'start')
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
'stop')
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
'restart')
$0 stop
$0 start
;;
'status')
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
# chmod 755 /etc/init.d/oracle
# chkconfig --add oracle
# chkconfig oracle on
http://localhost:1158/em
$ emctl stop dbconsole
$ emctl config emkey -repos -sysman_pwd
$ emctl secure dbconsole -sysman_pwd
$ emctl start dbconsole
$ emctl config emkey -remove_from_repos -sysman_pwd
$ lsnrctl start
$ lsnrctl status
$ lsnrctl stop
$ netstat -anp | grep 1521 | grep LISTEN
$ sqlplus "/as sysdba"
SQL> startup
SQL> shutdown normal|immediate|abort
$ vi ~/.bash_profile
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome
export ORACLE_HOME_LISTNER=$ORACLE_HOME/bin/lsnrctl
export ORACLE_SID=TMSRACDB
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export PATH=$ORACLE_HOME/bin:$PATH
Installed information
DB Global Name
SQL> SELECT * FROM props$ WHERE name='GLOBAL_DB_NAME';
SQL> SELECT * FROM global_name;
SQL> ALTER DATABASE RENAME GLOBAL_NAME TO <
SID
SQL> select name from v$database;
SQL> SELECT instance FROM v$thread;
re-installation
# rm -Rf /usr/local/bin/oraenv
# rm -Rf /usr/local/bin/coraenv
# rm -Rf /etc/oratab
# chkconfig oracle off
# chkconfig --del oracle
# rm -Rf /etc/init.d/oracle
# rm -Rf $ORACLE_HOME
$ unset ORACLE_HOME
$ unset TNS_ADMIN
기타
** tnsname.ora- $ORACLE_HOME/network/admin
- 로컬컴퓨터가 원격 서버로 접속할 방법을 서술
** listener.ora
- $ORACLE_HOME/network/admin
- 오라클서버에서 리스너를 기동시킬 때 (즉, lsnrctl start) 사용하게 되는 환경 파일
$ sqlplus -S scott/tiger < /data/script/test.sql
(-S : uses silent mode)
댓글 없음:
댓글 쓰기