Oracle数据库导入导出创建等常用操作语句汇总

导出dmp文件:
exp cbdb/“HUGE^GIS1”@ORCL file=d:\jncbdb.dmp

exp C##BUS_DATASYS/SHbus71ADcom@BUSGJDBA file=c:\C##BUS_DATASYS_bak.dmp

select count(*) as cnt
from v$session t

select t.username, t.MACHINE, t.TERMINAL, t.PROGRAM, t.OSUSER, count(*) as cnt
from v$session t
group by t.username, t.MACHINE, t.TERMINAL, t.PROGRAM, t.OSUSER order by cnt desc

SELECT ‘alter system kill session ‘’’||l.session_id||’,’||s.serial#||’’’;’
FROM v l o c k e d o b j e c t l , a l l o b j e c t s o , v locked_object l, all_objects o, v lockedobjectl,allobjectso,vsession s, v$process p

WHERE l.object_id = o.object_id

AND l.session_id = s.sid

AND s.paddr = p.addr

ORDER BY sid, s.serial#;

select username ,sid,serial# from v$session where username =‘WXFWDB’;
alter system kill session ‘13,24’ ;
alter system kill session ‘74,49’ ;
alter system kill session ‘203,5’ ;
select owner,table_name,tablespace_name from dba_tables
where tablespace_name=‘WXFWDB’
and table_name in (select mview_name from dba_mviews);

drop materialized view WXFWDB_YH.V_TZ_MAIN_CAILIAO PRESERVE TABLE;

select * from v$version查看版本号
PL/SQL Release 11.2.0.1.0 - Production
PL/SQL Release 10.2.0.4.0 - Production

exp pdaconfig/pdaconfig_gis1011@ORCL file=d:\pdaconfig.dmp owner=users
导入dmp文件:
imp authordb/authordb@SERVER1 file= full=y ignore=y

imp authordbs/authordbs@ORCL file= full=y ignore=y
–建表空间:
create tablespace zlssde datafile ‘D:\app\Administrator\oradata\server1\zlssde.dbf’ size 500M autoextend on next 5M maxsize unlimited;
–建用户:
create user zlssde identified by zlssde_gis1003 default tablespace zlssde temporary tablespace temp;
–给用户赋权限:
grant connect to zlssde;
grant resource to zlssde;
grant dba to zlssde;
grant select any table to zlssde;
–删除用户:
drop user authordb cascade;
–删除表空间:
drop tablespace bpmdb including contents and datafiles;

GRANT update,select,update,insert,delete ON test TO dbuser;
alter table 表名 drop column 字段名
imp wxfwdb/wxfwdb@server1 file=c:\wxfwdb_2017_09_18.dmp full=y ignore=y
表空间位置
select tablespace_name,file_id,bytes/1024/1024,file_name
   from dba_data_files order by file_id;

select t1.name,t2.name
from v t a b l e s p a c e t 1 , v tablespace t1,v tablespacet1,vdatafile t2
where t1.ts# = t2.ts#;

权限不足:
grant update on trackpos to authordbnew ;

grant insert on trackpos to authordbnew ;

口令已经失效
SELECT * FROM dba_profiles WHERE profile=‘DEFAULT’ AND resource_name=‘PASSWORD_LIFE_TIME’;
执行sql:ALTER PROFILE DEFAULT LIMIT PASSWORD_LIFE_TIME UNLIMITED;
https://blog.csdn.net/xxfigo/article/details/50674861

drop user authordb cascade;
drop tablespace authordb including contents and datafiles;
create tablespace authordb datafile ‘D:\APP\ADMINISTRATOR\ORADATA\SERVER1\authordb.DBF’ size 512M autoextend on next 512K maxsize unlimited extent management local;

create user authordb
identified by authordb
default tablespace authordb
temporary tablespace TEMP
profile DEFAULT;

grant connect to authordb;
grant dba to authordb;
grant resource to authordb;
grant unlimited tablespace to authordb;
GRANT SELECT ANY TABLE TO authordb;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值