Oracle基础教程:数据库的用户接口、启动关闭及随系统启动脚本

leek00 2012-02-21

这是DBA管理数据库的常用接口 命令行接口
 但这个环境过于简单 没有上下键翻查历史命令的功能
 安装软件添加翻查历史功能
 [root@dba ~]# rpm -ivh rlwrap-0.30-1.el5.i386.rpm
 切换到oracle用户 添加命令别名
 vim .bashrc
  alias  sql='rlwrap sqlplus'
  alias  sqlplus='rlwrap sqlplus'
  alias  lsnrctl='rlwrap lsnrctl'
  alias  rman='rlwrap rman'
 :wq
 加载 source .bash_profile

 连接oracle的方法:
 [oracle@dba ~]$ sql /nolog

 SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 25 05:24:37 2011

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

 SQL> conn / as sysdba
 Connected.
 SQL> show user
 USER is "SYS"
 SQL> exit
 Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
 With the Partitioning, OLAP and Data Mining options
 [oracle@dba ~]$
 


四. 数据库的启动和关闭

 启动
 [oracle@dba ~]$ sql /nolog

 SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 25 07:03:34 2011

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

 SQL> conn / as sysdba
 Connected to an idle instance.
 SQL> show user
 USER is "SYS"
 SQL> startup
 ORACLE instance started.

 Total System Global Area  285212672 bytes
 Fixed Size      1218992 bytes
 Variable Size     83887696 bytes
 Database Buffers   197132288 bytes
 Redo Buffers      2973696 bytes
 Database mounted.
 Database opened.
 SQL>
 
 关闭
 [oracle@dba ~]$ sql / as sysdba

 SQL*Plus: Release 10.2.0.1.0 - Production on Fri Feb 25 07:04:30 2011

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


 Connected to:
 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
 With the Partitioning, OLAP and Data Mining options

 SQL> show user
 USER is "SYS"
 SQL> shut immediate
 Database closed.
 Database dismounted.
 ORACLE instance shut down.
 SQL> exit

相关推荐