- 导出数据命令行
文件 expdata.bat parfile指向expdata.par文件
exp parfile=D:\exp\expdata.par file=txgl.dmp filesize=600M log=dl.log
文件expdata.par
<a target=_blank href="mailto:userid=txgl/123456@ZZSorcl">userid=txgl/123456@ZZSorcl</a> buffer=8192000 compress=n grants=n
- 导入数据
文件impdata.bat
imp system/password@orcl fromuser=sntap touser=snt parfile=impdata.par
文件impdata.par
file=oraclebak.dmp buffer=2048000 ignore=n commit=y
- 导入数据 不写par
imp system/password@orcl fromuser=from_user touser=to_user file=E:\test\bak\test.dmp log=E:\test\bak\test.log buffer=2048000 ignore=y commit=y
如果是不同的表空间,touser要一个权限,不然clob类型字段的表会出错:GRANT UNLIMITED TABLESPACE TO TO_USER
- Windows定时备份
新建bat文件 内容:
@echo off echo 正在备份 Oracle 数据库,请稍等...... set riqi=%date:~0,4%%date:~5,2%%date:~8,2% exp system/password@orcl file=E:\oraclebak\oraclebak%riqi%.dmp log=F:\oraclebak\oraclebak%riqi%.log buffer=960000 echo 任务完成! echo 开始清理备份文件 forfiles /p "E:\oraclebak" /s /m *.* /d -6 /c "cmd /c del @path"
在window计划任务里面添加定时任务,设置备份的间隔时间,每天执行的时间,在“操作”选项卡里面选择新建好的bat文件。“常规”选项卡里面选择“不管用户是否登录都要运行”
-------------------------------------------------------------------------------------------------------------------------------------------
创建Oracle用户:
create user newuser identified by "password" --default tablespace TBS_DATA01 --temporary tablespaceTBS_DATA01_temp profile DEFAULT --表空间 quota unlimited on newuser; -- Grant/Revoke role privileges --用户 grant connect to newuser; -- Grant/Revoke system privileges grant create any index to newuser; grant create any sequence to newuser; grant create any table to newuser; grant create any trigger to newuser; grant create any view to newuser; grant create procedure to newuser; grant select any dictionary to newuser; grant select any sequence to newuser; GRANT UNLIMITED TABLESPACE TO newuser;