【02.26】linux下oracle 初步配置的学习

1 :    环境变量配置文件.bash_profile;

           linux oracle下进入sqlplus的方法;

            部分指令的学习

       

[root@localhost ~]# cd /home
[root@localhost home]# ls
oracle  zkl                             //home下又能多个账户,只有oracle账户下的.bash_profile文件才是我们的目的。也可以通过再oracle用户下,cd ~目录下寻找。
[root@localhost home]# cd oracle
[root@localhost oracle]# ls -a         // ls 即list;-as显示隐藏文件
.   .bash_history  .bash_profile  .mozilla
..  .bash_logout   .bashrc        oraInventory
[root@localhost oracle]# more .bash_profile //通过more来查看bash文件的内容并作编辑。也可以通过vi .bash_profile查看,通过i命令编辑,通过esc退出,:wq退出vi
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export ORACLE_SID=test                                             //oracle sid区别于sid
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/9.1.0                            //sqlplus文件所在的地方
export LD_LIBRARY_PATH=/opt/app/oracle/9.1.0/lib:/lib:/usr/lib:/usr/local/lib:/u
sr/X11R6/lib
export TNS_ADMIN=/opt/app/oracle/9.1.0/network/admin
export ORA_NLS33=/opt/app/oracle/9.1.0/ocommon/nls/admin/data
export ORACLE_OWNER=oracle
export ORACLE_TERM=xterm
export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:
/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/app/oracle/9.1.0/bin
:/home/oracle/Opatch:/sbin
[root@localhost oracle]# 
[root@localhost oracle]# 
[root@localhost oracle]# 
[root@localhost oracle]# cd ~
[root@localhost ~]# more .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
unset USERNAME
[root@localhost ~]# su oracle                   //通过su  switch user来切换用户
[oracle@localhost root]$ cd ~
[oracle@localhost ~]$ more .bash_profile 
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export ORACLE_SID=test
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/9.1.0
export LD_LIBRARY_PATH=/opt/app/oracle/9.1.0/lib:/lib:/usr/lib:/usr/local/lib:/u
sr/X11R6/lib
export TNS_ADMIN=/opt/app/oracle/9.1.0/network/admin
export ORA_NLS33=/opt/app/oracle/9.1.0/ocommon/nls/admin/data
export ORACLE_OWNER=oracle
export ORACLE_TERM=xterm
export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:
/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/app/oracle/9.1.0/bin
:/home/oracle/Opatch:/sbin
[oracle@localhost ~]$ 
[oracle@localhost ~]$ 
[oracle@localhost ~]$ 
[oracle@localhost ~]$ more .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
export ORACLE_SID=test
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/9.1.0
export LD_LIBRARY_PATH=/opt/app/oracle/9.1.0/lib:/lib:/usr/lib:/usr/local/lib:/u
sr/X11R6/lib
export TNS_ADMIN=/opt/app/oracle/9.1.0/network/admin
export ORA_NLS33=/opt/app/oracle/9.1.0/ocommon/nls/admin/data
export ORACLE_OWNER=oracle
export ORACLE_TERM=xterm
export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:
/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/app/oracle/9.1.0/bin
:/home/oracle/Opatch:/sbin
export ORACLE_SID=orcl
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/9.1.0
export LD_LIBRARY_PATH=/opt/app/oracle/9.1.0/lib:/lib:/usr/lib:/usr/local/lib:/u
sr/X11R6/lib
export TNS_ADMIN=/opt/app/oracle/9.1.0/network/admin
export ORA_NLS33=/opt/app/oracle/9.1.0/ocommon/nls/admin/data
export ORACLE_OWNER=oracle
export ORACLE_TERM=xterm
export PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:
/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/root/bin:/opt/app/oracle/9.1.0/bin
:/home/oracle/Opatch:/sbin
[oracle@localhost ~]$ 
[oracle@localhost ~]$ 
[oracle@localhost ~]$ 
[oracle@localhost ~]$ vi .bash_profile                         //编辑 bash文件
[oracle@localhost ~]$ sqlplus /nolog
bash: sqlplus: command not found
[oracle@localhost ~]$ source .bash_profile                   //soerce之后下文saqlplus/nolog指令才有效;并且:::只有当前目录是bash目录时,source才有效。
[oracle@localhost ~]$ sqlplus /nolog                        //进入sql语句

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 26 11:24:49 2014

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> quit                                        //退出sql语句。
[oracle@localhost ~]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 26-FEB-2014 11:25:03

Copyright (c) 1991, 2005, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date                26-FEB-2014 09:36:17
Uptime                    0 days 1 hr. 48 min. 46 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/app/oracle/9.1.0/network/admin/listener.ora
Listener Log File         /opt/app/oracle/9.1.0/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" 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
[oracle@localhost ~]$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 26 11:25:17 2014

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

SQL> conn sys/system@orcl as sysdba                //用户登录与连接
Connected.
SQL> startup                                      //数据库启动
ORA-01081: cannot start already-running ORACLE - shut it down first
SQL> 









  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值