Chinaunix首页 | 论坛 | 博客
  • 博客访问: 101392053
  • 博文数量: 19283
  • 博客积分: 9968
  • 博客等级: 上将
  • 技术积分: 196062
  • 用 户 组: 普通用户
  • 注册时间: 2007-02-07 14:28
文章分类

全部博文(19283)

文章存档

2011年(1)

2009年(125)

2008年(19094)

2007年(63)

分类: Oracle

2008-04-30 15:58:31

--创建样例用户SCOTT及数据--
在dos命令下,执行:
set ORACLE_SID=ORCL
sqlplus “/ as sysdba”
@(oracle_home)/RDBMS/ADMIN/scott.sql
alter user scott --account unlock--什么意思??;

**********************************
--创建表空间命令--

CREATE TABLESPACE tablespace_name DATAFILE datafile_name SIZE numberM
例===>>
CREATE TABLESPACE "LZC"
LOGGING
DATAFILE 'D:\ORACLE92\ORADATA\LIZHCH\LZC.ora' SIZE 5M EXTENT
MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO
删除表空间
DROP TABLESPACE tablespace_name
**********************************
--用户管理--
创建用户
CREATE USER user IDENTIFIED BY pwd
删除用户
DROP USER user CASCADE
**********************************
--权限管理--
用户授权
GRANT role TO user
收回权限
REVOKE role FROM user
**********************************
权限管理
表授权
GRANT privilege ON table TO user
收回权限
REVOKE privilege ON table FROM user
**********************************
--数据库启动方式--
startup nomount--
startup mount--
start up open--
--数据库关闭的方式--
shutdown normal--
shutdown trunsection--
shutdown immediate--
shutdown abort
***********************************
--备份整个数据库--
exp system/pwd@orcl file=c:\exp_full.dmp full=y log=c:\exp_full.log
--备份某个schema--
exp scott/tigger@orcl file=c:\exp_scott.dmp owner=scott log=c:\exp_scott.log
--备份某个表--
exp scott/tigger@orcl file=c:\exp_table.dmp tables(emp,dept) log=c:\exp_table.log
--恢复整个数据库--
imp system/pwd@orcl file=c:\exp_full.dmp full=y log=c:\imp_full.log
--恢复某个schema--
imp scott/tigger@orcl file=c:\exp_scott.dmp fromuser=scott touser=scott log=c:\imp_scott.log
--恢复某个表--
imp scott/tigger@orcl file=c:\exp_table.dmp tables(emp,dept) log=c:\imp_table.log


***********************************
--查看执行计划--
set timing on 反馈执行时间
set linesize 180
set autotrace on 自动反馈执行时间和执行统计信息,一共4步:
1)用sys用户:SQLPLUS/admin/plustrace.sql
2)用sys用户 :grant PLUSTRACE to scott
3)用普通用户:@?/RDBMS/Admin/utlxplan.sql
4) set autotrace on 打开跟踪
set autotrace trace 不显示执行结果
***********************************
散列连接 (HASH JOIN)效率比较高~~
select /*+use_hash(a b)*/* from dept a,emp b where a.deptno=b.deptno

 

原文:http://xuzhengjun.blog.ccidnet.com/blog-htm-itemid-209959-do-showone-type-blog-uid-15219.html

阅读(89) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~