oracle 最常用的命令

在sql developer中执行

create user f identified by y;

grant dba to f;

在命令行中执行
exp f/y buffer=64000 file=d:\b.dmp owner=f

imp f/y@orcl file=D:\b.dmp full=y ignore=y

 

针对Oracle 11gexp是无法导出空表的解决方案。

   1、先查询一下当前用户下的所有空表 

      select table_name from user_tables where NUM_ROWS=0; 

    2、用以下这句查找空表 

      select 'alter table '||table_name||' allocate extent;' from user_tables where num_rows=0 

       把查询结果导出,执行导出的语句 

 3、然后再执行 

       exp 用户名/密码@数据库名 file=/home/oracle/exp.dmp log=/home/oracle/exp_smsrun.log   成功! 

 

一,windows下面的备份 
1,先写一个数据库备份的bat脚本,确保能够在命令行下执行 
exp f/y buffer=64000 file=d:\dbbak\f_%date:~0,4%%date:~5,2%%time:~0,2%%time:~3,2%.dmp log=d:\dbbak\f_%date:~0,4%%date:~5,2%%time:~0,2%%time:~3,2%.log
2,添加定时计划(开始——>程序-->附件-->系统工具-->定时计划) 
按照指定的步骤依次添加即可 

 

 存储设备建表空间

create tablespace ecology datafile '/oradata/oadb/ecology.dbf' size 8000M AutoExtend  On Next 10M segment space management auto;

CREATE USER cology IDENTIFIED BY cology DEFAULT TABLESPACE ecology TEMPORARY TABLESPACE Temp;                
grant connect,resource,dba to ecology8;

impdp ecology/ecology@oadb directory=/home dumpfile=dmp20140705.dmp EXCLUDE=STATISTICS  REMAP_SCHEMA=cology:ecology

 

查询最近执行的SQL语句

select last_load_time,disk_reads,sorts,fetches,buffer_gets,optimizer_cost,cpu_time,sql_fulltext,sql_text from v$sql where to_char(last_load_time)> '2014-07-10/14:00:00'  order by last_load_time desc;

不能打开到主机的连接, 在端口 1521: 连接失败  

http://lggsuper.blog.163.com/blog/static/194633320102313342578/

猜你喜欢

转载自baijinshan.iteye.com/blog/2024499