使用 SQL*Plus 访问数据库


使用 SQL*Plus 访问数据库

使用 SQL*Plus 访问数据库

以 oracle 身份登录到 Linux。设置环境。

设置 Oracle 环境变量:

$ export ORACLE_BASE=/u01/app/oracle
$ export ORACLE_SID=demo1
$ export ORACLE_HOME=$ORACLE_BASE/product/10.1.0/db_1
$ export PATH=$PATH:$ORACLE_HOME/bin

运行 SQL*Plus:

$ sqlplus

SQL*Plus:Release 10.1.0.2.0 - Production on Sat Jun 5 16:59:21 2004

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

Enter user-name:/ as sysdba

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

SQL> 

使用 Oracle Enterprise Manager 10 g 数据库控制

在 Web 浏览器中,连接到安装过程中提供的 URL。

例如:
http://ds1.orademo.org:5500/em (如果服务器不在 DNS 中,则必须使用 IP 地址代替主机名。)

用户名: SYS
口令: <安装过程中选择的口令>
连接为: SYSDBA

单击

  1<login>
  2
  3![使用 SQL*Plus 访问数据库](http://www.cndw.com/ShowImg.asp?p=/2006-5-11/762183ll135_1.gif)  
  4---  
  5  
  6欢迎走入 Oracle Enterprise Manager 10 _g_ 数据库控制的精彩世界! 
  7
  8启动和停止 Oracle Enterprise Manager 数据库控制: 
  9    
 10    
 11    $ emctl start dbconsole
 12    $ emctl stop dbconsole
 13    
 14
 15使用 iSQL*Plus 访问数据库 
 16
 17iSQL*Plus 是历史悠久的 SQL*Plus 交互式工具的基于 Web 的版本,用于访问数据库。要使用 iSQL*Plus,请单击 OEM 控制台 Related Links 部分中的 iSQL*Plus 链接,或将浏览器指向安装过程中提供的 iSQL*Plus URL。 
 18
 19例如:   
 20http://ds1.orademo.org:5560/isqlplus  (如果数据库服务器不在 DNS 中,则必须使用 IP 地址代替主机名。) 
 21
 22用户名:  SYSTEM    
 23口令:  &lt;安装过程中选择的口令&gt;
 24
 25单击 <login>。 
 26
 27在 Workspace 框中输入 SQL 命令,然后单击 **Execute** 。 
 28
 29![使用 SQL*Plus 访问数据库](http://www.cndw.com/ShowImg.asp?p=/2006-5-11/844113ll135_2.gif)  
 30---  
 31  
 32启动和停止 iSQL*Plus: 
 33    
 34    
 35    $ isqlplusctl start
 36    $ isqlplusctl stop
 37    
 38
 39启动和停止监听器: 
 40
 41监听器接受客户端的连接请求,并在验证证书后创建数据库连接。要使用 OEM 或 iSQL*Plus,必须先启动监听器。 
 42    
 43    
 44    $ lsnrctl start
 45    $ lsnrctl stop
 46    
 47
 48启动和停止数据库: 
 49
 50启动和停止数据库的最简单方法是从 OEM 控制台启动和停止。要从命令行执行此操作,请在以 oracle 身份登录后使用 SQL*Plus,如下所示: 
 51
 52启动: 
 53    
 54    
 55    $ sqlplus
 56    
 57    SQL*Plus:Release 10.1.0.2.0 - Production on Sun Jun 13 22:27:48 2004
 58    
 59    Copyright (c) 1982, 2004, Oracle.All rights reserved.
 60    
 61    Enter user-name:/ as sysdba
 62    Connected to an idle instance.
 63    
 64    SQL&gt; startup
 65    ORACLE instance started.
 66    
 67    Total System Global Area  188743680 bytes
 68    Fixed Size                   778036 bytes
 69    Variable Size             162275532 bytes
 70    Database Buffers           25165824 bytes
 71    Redo Buffers                 524288 bytes
 72    Database mounted.
 73    Database opened.
 74    SQL&gt; exit
 75    
 76
 77Shutdown: 
 78    
 79    
 80    $ sqlplus
 81    
 82    SQL*Plus:Release 10.1.0.2.0 - Production on Sun Jun 13 22:25:55 2004
 83    
 84    Copyright (c) 1982, 2004, Oracle.All rights reserved.
 85    
 86    Enter user-name:/ as sysdba
 87    
 88    Connected to:
 89    Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
 90    With the Partitioning, OLAP and Data Mining options
 91    
 92    SQL&gt; shutdown immediate
 93    Database closed.
 94    Database dismounted.
 95    ORACLE instance shut down.
 96    SQL&gt; exit
 97    
 98
 99列出 Oracle 进程: 
100    
101    
102    $ ps a</login></login>
Published At
Categories with 数据库类
Tagged with
comments powered by Disqus