Home | 簡體中文 | 繁體中文 | 雜文 | 打賞(Donations) | Github | OSChina 博客 | 雲社區 | 雲棲社區 | Facebook | Linkedin | 知乎專欄 | 視頻教程 | About

第 78 章 CLI

目錄

78.1. SQL*Plus
78.1.1. conn
78.1.2. startup/shutdown
78.1.2.1. startup
78.1.2.2. shutdown
78.1.3. $ORACLE_HOME/sqlplus/admin/glogin.sql
78.1.4. @運行SQL
78.1.5. 連結資料庫
78.2. exp/imp
78.2.1. exp
78.2.2. imp
78.2.2.1. A用戶導出B用戶導入
78.3. expdp/impdp
78.3.1. expdp
78.3.2. impdp
78.3.3. 數據泵演示
78.3.4. 查看dmp檔案的表空間
78.4. RMAN
78.4.1. 資料庫模式
78.4.2. 完全備份
78.4.3. 增量備份
78.4.4. 恢復資料庫
78.4.5. 是用tar打包rman檔案
78.4.6. 打包 rman 備份檔案

78.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>	
	
	

78.1.1. conn

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

78.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;
		
		

78.1.2.1. startup

SYS@orcl> startup			
			

78.1.2.2. shutdown

			
SYS@orcl> shutdown immediate
			
			

78.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';
		
		

78.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
		

78.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)))"