1、oracle 账户登录linux;
2、如果存在多个切换实例:命令:export ORACLE_SID=实例名;
如:export ORACLE_SID=utf8186
3、切换至管理员账户:
sqlplus '/as sysdba'
3.1 查看当前实例名:
show parameter instance_name; #查看当前实例名
-----------------------------------------------------------------------------------
4、查看数据库空间文件路径:
命令:
select name from v$datafile;
或者
select tablespace_name,file_id,bytes/1024/1024,file_name from dba_data_files order by file_id;
----------------------------------------------------------------------------------------------------------
5、创建临时表空间:
查看临时表空间文件路径:
select name from v$tempfile;
命令:
create temporary tablespace temp02 tempfile '/opt/oracle/db/oradata/utf8186/temp02.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
/*temp02为临时表空间名称,/opt/oracle/db/oradata/utf8186/temp02.dbf为临时表空间地址*/
删除临时表空间
drop tablespace temp02 including contents and datafiles cascade constraint;
-------------------------------------------------------------------------------------------
6、创建表空间:
查看表空间文件路径:
select name from v$datafile;
命令:
create tablespace yi_data logging datafile '/opt/oracle/db/oradata/utf8186/yi_data.dbf' size 50m autoextend on next 50m maxsize 20480m extent management local;
alter user username quota unlimited on tablespace_name;
修改表空间
--扩展空间,将数据文件扩大至5000MB
alter database datafile '/oracle/app/oracle/oradata/gbk176/CRM_DATA_CM.dbf' resize 5000m;
--自动增长,表空间不足时增加20MB,最大扩展5000MB
alter database datafile '/oracle/app/oracle/oradata/gbk176/CRM_DATA_CM.dbf' autoextend on next 50m maxsize 60000m;
--扩展无限大空间
alter database datafile '/oracle/app/oracle/oradata/gbk176/CRM_DATA_CM.dbf' autoextend on maxsize unlimited;
删除表空间
drop tablespace bcp_bj_data including contents and datafiles cascade constraint;
---------------------------------------------------
7、创建用户并指定默认表空间:
命令:
create user ios_test identified by ios default tablespace yiqiwo_data_test temporary tablespace temp_yiqiwo_test;
删除用户
drop user iosyqw cascade;
drop user gdsv cascade;
create user GDJF identified by ios default tablespace CRM_DATA_CM temporary tablespace temp_CRM_DATA_CM;
-----------------------------------------------------
8、给用户授权:
命令:
grant connect,resource,dba to username;
grant connect,resource,dba to GDJF;
//DBA:拥全部特权,是系统最高权限,只有DBA才可以创建数据库结构。
RESOURCE:拥Resource权限的用户只可以创建实体,不可以创建数据库结构。
CONNECT:拥Connect权限的用户只可以登录Oracle,不可以创建实体,不可以创建数据库结构。
拥以上个权限的用户就拥了登陆、增删改查、创建数据库结构、实体的权限。
grant dba to iosgd;
grant connect,resource to iosgd;
grant select any table to GDJF;
grant delete any table to GDJF;
grant update any table to GDJF;
grant insert any table to GDJF;
-----------------------------------------------------
9、导入dmp:
切换至管理员账户:sqlplus '/as sysdba'
查看当前实例SID命令:
select instance_name from v$instance;
exit退出命令执行窗口后,执行
将dmp文件上传至服务器(oracle账户登录),执行命令:
imp iosgd/ios@SID full=y file=./test.dmp ignore=y
imp iosyqw/ios full=y file=./yqw_diy_20180417.dmp ignore=y;
imp YLJS/ios full=y file=/oracle/dmp_data/hlhu_neimeng20181024dmp/st_compare_report.dmp ignore=y;
imp YLJS/ios full=y file=/oracle/dmp_data/hlhu_neimeng20181024dmp/mp_report_base.dmp ignore=y;
imp YLJS/ios full=y file=/oracle/dmp_data/hlhu_neimeng20181024dmp/yljs20111118.dmp ignore=y;
imp YLJS/ios full=y file=/oracle/dmp_data/hlhu_neimeng20181024dmp/mp_pro_config.dmp ignore=y;
imp YLJS/ios full=y file=/oracle/dmp_data/hlhu_neimeng20181024dmp/table.dmp ignore=y;
//imp 用户名/密码@实例名 full=y file=dmp文件路径及文件名 ignore=y
导出dmp:
1,将数据库ORACLE完全导出,用户名system密码manager 导出到c:daochu.dmp中
exp system/manager@ORACLE file=c:daochu.dmp full=y
或 exp test/test@10.10.10.10:1521/orcl file=E:aaa.dmp
2,将数据库中RFD用户与,JYZGCX用户的表导出
exp system/manager@ORACLE file=d:daochu.dmp owner=(RFD,JYZGCX)
列如:导出北京用户所属数据
命令:exp ios_bj/ios file=./bj.dmp owner=ios_bj
命令:exp iosyqw/ios file=./yqw.dmp owner=iosyqw
3,将数据库中的表T_USER、T_ROLE导出
exp JYZGCX/JYZGCX@ORACLE file= d:data
ewsmgnt.dmp tables=(T_USER,T_ROLE)
exp ios_bj/ios file=./tb_msg_send_bak_201803.dmp tables=tb_msg_send_bak_201803
------------------------------------------------------------------------------