Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | 51CTO学院 | CSDN程序员研修院 | OSChina 博客 | 腾讯云社区 | 阿里云栖社区 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏多维度架构

第 76 章 CLI

目录

76.1. SQL*Plus
76.1.1. conn
76.1.2. startup/shutdown
76.1.3. $ORACLE_HOME/sqlplus/admin/glogin.sql
76.1.4. @运行SQL
76.1.5. 链接数据库
76.2. exp/imp
76.2.1. exp
76.2.2. imp
76.3. expdp/impdp
76.3.1. expdp
76.3.2. impdp
76.3.3. 数据泵演示
76.3.4. 查看dmp文件的表空间
76.4. RMAN
76.4.1. 数据库模式
76.4.2. 完全备份
76.4.3. 增量备份
76.4.4. 恢复数据库
76.4.5. 是用tar打包rman文件
76.4.6. 打包 rman 备份文件

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

76.1.1. conn

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

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

76.1.2.1. startup

SYS@orcl> startup			
			

76.1.2.2. shutdown

			
SYS@orcl> shutdown immediate
			
			

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

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

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