Home | 简体中文 | 繁体中文 | 杂文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 作品与服务 | Email

第 39 章 CLI

目录

39.1. SQL*Plus
39.1.1. conn
39.1.2. startup/shutdown
39.1.2.1. startup
39.1.2.2. shutdown
39.1.3. $ORACLE_HOME/sqlplus/admin/glogin.sql
39.1.4. @运行SQL
39.1.5. 链接数据库
39.2. exp/imp
39.2.1. exp
39.2.2. imp
39.2.2.1. A用户导出B用户导入
39.3. expdp/impdp
39.3.1. expdp
39.3.2. impdp
39.3.3. 数据泵演示
39.3.4. 查看dmp文件的表空间
39.4. RMAN
39.4.1. 数据库模式
39.4.2. 完全备份
39.4.3. 增量备份
39.4.4. 恢复数据库
39.4.5. 是用tar打包rman文件
39.4.6. 打包 rman 备份文件

39.1. SQL*Plus

sqlplus /nolog

	
[oracle@wcs ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Sat May 28 18:19:53 2011

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

SQL> conn / as sysdba;
Connected to an idle instance.
SQL> exit
	
	

sqlplus / as sysdba

	
[oracle@wcs ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sat May 28 18:31:25 2011

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL>	
	
	

39.1.1. conn

SQL>conn system/manger@orcl as sysdba
		
conn sys/sys@ip:1521/orainstance as sysdba		
		

39.1.2. startup/shutdown

		
[oracle@localhost ~]$ sqlplus

SQL*Plus: Release 10.2.0.1.0 - Production on Tue Jan 5 09:44:13 2010

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

Enter user-name: sys as sysdba
Enter password:
		
		
		
SQL> conn / as sysdba;
		
		

39.1.2.1. startup

SYS@orcl> startup			
			

39.1.2.2. shutdown

			
SYS@orcl> shutdown immediate
			
			

39.1.3. $ORACLE_HOME/sqlplus/admin/glogin.sql

		
set line 2000
set linesize 2000 
set pagesize 100
col ename format a30 
col sal format 999,999.999 
alter session set nls_date_format = 'yyyy-mm-dd hh24:mi:ss';
		
		

39.1.4. @运行SQL

		
SQL> @ /home/oracle/your.sql
		
		
set pagesize 0
set linesize 80
set term off
set feed off
set echo off
set show off
set veri off
set head off

spool outputfile
select * from dba_users;
/
spool off
		

39.1.5. 链接数据库

Example: Connect to database using Net Service Name and the database net service name is ORCL.

sqlplus myusername/mypassword@ORCL
		

sqlplus "user/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=192.168.4.9)(Port=1521))(CONNECT_DATA=(SERVER = DEDICATED)(SERVICE_NAME = orcl.example.com)))"		
		
comments powered by Disqus