--关于oracle11g导出时有缺失表的情况的解决办法:
--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、根据以上这条语句查询出所有空表,为空表手工分配空间,也可以为视图,索引分配extent。
-- 然后将所有查出的结果拷贝出来执行,执行完成后再进行数据库导出操作。
--创建用户
create user supp_sys identified by supporter default tablespace XINTANG
temporary tablespace temp profile default quota unlimited on users;
create user supp_app identified by supporter default tablespace XINTANG
temporary tablespace temp profile default quota unlimited on users;
create user supp_log identified by supporter default tablespace XINTANG
temporary tablespace temp profile default quota unlimited on users;
--给用户授权
grant dba,connect,resource,aq_administrator_role,aq_user_role,authenticateduser to supp_sys;
grant dba,connect,resource,aq_administrator_role,aq_user_role,authenticateduser to supp_app;
grant dba,connect,resource,aq_administrator_role,aq_user_role,authenticateduser to supp_log;
--把所有权限都给bm_sys:
grant all privileges to bm_sys;
--导入全部(命令中执行)
imp supp_app/supporter@xintang file=D:\a\2018-04-18.dmp full=y
--导出全部用户(命令中执行)
exp supp_app/supporter@xintang file=d:\2018-04-18.dmp owner=supp_app,supp_sys,supp_log
--创建表空间
--超过100m时,每次增加50m,最大增加到2000m,可以将maxsize 2000m去掉,只写next 50m。
create tablespace bmv5
logging
datafile 'D:\bmv5.dbf'
size 100m
autoextend on
next 50m maxsize 2000m;
--查询表空间
select * from dba_tablespaces;
--删除 新建 表空间
drop tablespace bmv5 including contents and datafiles cascade constraints;
--删除 用户
drop user bm_sys cascade;
--修改用户密码
alter user bm_app identified by supporter;
--无监听程序:
将listener.ora和tsnames.ora的host改成计算机的名称(计算机名可以右键我的电脑找到)
--修改最大连接数
select count(*) from v$process; ----- 查看当前已连接的连接数(进程)
select value from v$parameter where name = 'processes'; -----查看最大连接数(进程)
alter system set processes = 500 scope = spfile;--- 将最大连接数改为500
shutdown immediate;---立即重启服务
startup;---立即重启服务
--要保证在统计(查询)执行过程中,记录不被其他用户更新,则可以使用For update子句进行加锁。这样在这个--锁释放前其他用户不能对这些记录作update、delete和加锁。
--如果你使用了FOR UPDATE来对表进行加锁,则必须用commit来释放加锁的记录。
--根据某个时间点查询已删除的数据,前提是你能准确知道已删除的记录
select * from 表 as of timestamp to_timestamp('2017-3-20 10:49:40', 'YYYY-MM-DD HH:MI:SS');
--查看用户的所属表空间,然后将导出文件dmp中的表空间进行修改
select username,default_tablespace from dba_users order by username;
--查询用户下所有表名和试图名
select * from tab order by tabtype;
select * from tab where tabtype='TABLE';--只查表名
select * from tab where tabtype='VIEW';--只查试图名