Tip: 数据库表空间位jsyzt, 用户为OA ,密码为OA
文件夹 WebImServer_v3.2 为 信息传递功能文件。
cmd->sqlplus 用户名/密码@数据库名 (as sysdba) ->enter 注:如果此用户名不是系统用户sys,scott,system就不需要加as sysdba
1.创建表空间
create tablespace jsyzt
logging
datafile 'F:\Oracle\kqdata.jsyzt'
size 100m
autoextend on
next 50m maxsize unlimited
extent management local;
create user OA identified by OA default tablespace jsyzt quota 10m on users;
3.授权
分配用户权限
分配刚刚新建的用户 默认 dba
分配刚刚新建的用户 默认 dba
4.导入表数据
imp OA
/
OA
@
orcl
file=
G
:
\OA20150705.dmp
full=
y
imp BDCDJ0616/
BDCDJ0616
@orcl file=f
:
\
BDCDJ
1027.dmp full=y
//删除表空间
drop tablespace tablespace_name including contents and datafiles;
全局数据库名:orcl
数据库口令:luckytjx
Enterprise Manager Database Control URL - (orcl) : http://lucky-PC:1158/em 数据库配置文件已经安装到 F:\oracle\product\10.2.0,同时其他选定的安装组件也已经安装到 F:\oracle\product\10.2.0\db_5。 iSQL*Plus URL 为: http://lucky-PC:5560/isqlplus iSQL*Plus DBA URL 为: http://lucky-PC:5560/isqlplus/dba
administer resource manager
comment any table
unlimited tablespace
cmd
sqlplus/nolog
conn/as sysdba
--创建数据临时表空间
create temporary tablespace tempdatabase
tempfile 'D:\oracle\product\10.2.0\oradata\xzzf\tempdatabase.dbf'
size 32m
autoextend on
next 32m maxsize 2048m
extent management local;
--创建数据表空间
create tablespace dzjc
logging
datafile 'D:\oracle\product\10.2.0\oradata\dzjc\dzjc.dbf'
size 600m
autoextend on
next 32m maxsize UNLIMITED
extent management local;
--删除表空间
DROP TABLESPACE dzjc INCLUDING CONTENTS AND DATAFILES;
--创建用户并指定表空间
create user dzjc_beijing identified by wssp
default tablespace dzjc
temporary tablespace tempdatabase;
--给用户授予权限
grant dba to dzjc_beijing;
grant connect,resource,dba to dzjc_beijing;
--删除用户
drop user dzjc_beijing cascade;
--将表移至另外一个表空间下,且不删除表中数据
alter table t_sys_sql_err move tablespace dzjc
--导入数据库
imp userid=dzjc_beijing/wssp full=y file=d:\20100420dzjc_beijing.dmp log=d:\12.log ignore=y
imp dzjc_beijing/12345678@orcl file=d:\20110402dzjc_beijing.dmp f
romuser=dzjc_beijing log=d:\20110426.log
exp bjsp_tysp/12345678@orcl file=d:\20110523bjsp_tysp.dmp owner=b
jsp_tysp
===============================================
第一步:查看表空间的名字及文件所在位置:
select tablespace_name, file_id, file_name,round(bytes/(1024*1024),0) total_space from dba_data_files order by tablespace_name
第二步:增大所需表空间大小
alter database datafile '表空间位置'resize 新的尺寸。
例如:alter database datafile '\oracle\oradata\anita_2008.dbf' resize 4000m。
第三步:设置表空间自动扩展:
ALTER DATABASE
DATAFILE 'D:\APP\USERDATA\SQYZT.DBF' AUTOEXTEND
ON NEXT 100M MAXSIZE UNLIMITED
===============================================================
--删除空的表空间,但是不包含物理文件
drop tablespace tablespace_name;
--删除非空表空间,但是不包含物理文件
drop tablespace tablespace_name including contents;
--删除空表空间,包含物理文件
drop tablespace tablespace_name including datafiles;
--删除非空表空间,包含物理文件
drop tablespace tablespace_name including contents and datafiles; 【测试有效】
--如果其他表空间中的表有外键等约束关联到了本表空间中的表的字段,就要加上CASCADE CONSTRAINTS
drop tablespace tablespace_name including contents and datafiles CASCADE CONSTRAINTS;
数据库导出
exp BDCDJ0616/BDCDJ0616@192.168.1.8/ORCL file=f
:\AAA
\BDCDJ1022.dmp
数据泵导入
impdp BDCDJ0616/BDCDJ0616 directory=DATA_DESK dumpfile=BDCDJ_0107.DMP schemaS=BDCDJ
impdp system/mwj directory=DATA_DESK dumpfile=BB201605032003.DMP
schemaS=BDCDJ
数据泵导出
expdp BDCDJ/BDCDJ@172.10.21.249/
orcl1
directory
=bak
dumpfile=BDCDJ0324.dmp
schemas=BDCDJ_ZF logfile=
BDCDJ0324.log
expdp system/mwj
directory
=DATA_DESK
dumpfile=BDCDJ0426.dmp
schemas=BDCDJ logfile=
BDCDJ0426.log
oracle单独导出导入一张表
1.导出
expdp iis/iis@cdciis directory=DATA_PUMP_DIR DUMPFILE=IMMU_CLIENT_USER_ORG_BAK_20111208.dmp tables=IMMU_CLIENT_USER_ORG_BAK
2.导入到本地
C:\Documents and Settings\Administrator>impdp lwh/lwh@orcl directory=DATA_PUMP_DIR dumpfile=IMMU_CLIENT_USER_ORG_BAK_20111208.dmp full=y remap_schema=iis:lwh
remap_tablespace=TS_IMMU_BK:lwh
//
expdp BDCDJ_ZF/BDCDJ_ZF@ORCL directory=dmpdir schemas=BDCDJ_ZF dumpfile=20160613_BDCDJ_ZF.dmp logfile=20160613_BDCDJ_ZF.log;
expdp 用户/密码@ORCL directory=目录名 schemas=用户 dumpfile=20151031_xx.dmp logfile=20151031_xx.log;
简单导入:impdp 用户/密码@orcl directory=目录名 dumpfile=20151031_xx.dmp logfile=20151031_xx_import.log
不同用户、表空间导入:
impdp 用户/密码@orcl directory=目录名 dumpfile=20151031_xx.dmp logfile=20151031_xx_import.log remap_schema=原用户:新用户 remap_tablespace=(原表空间:新表空间)
impdp BDCDJ_ZF/BDCDJ_ZF@orcl directory=orabakzf dumpfile=BDCDJ0330.DMP remap_schema=BDCDJ_ZF:BDCDJ_ZF remap_tablespace=(BDCDJ:BDCDJ_ZF,BDCDJ_ZF:BDCDJ_ZF)
导出表:
D:\> exp 用户/密码 tables=表
D:\> exp 用户/密码 tables=(表1,…,表2)
D:\> exp system/manager tables=(用户.表)
D:\> exp system/manager tables=(用户1.表1,用户2.表2)
导入表:
D:\>imp study/study@orcl file=zrp.dmp tables=toms ignore=y
不加ignore=y是不行的,会报错
同时不写file名称也是不行的,会默认去建一张新表,但是如果存在同名就会报错....