温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

windows下Oracle11G脚本建用户、表空间、表

发布时间:2020-08-07 22:31:32 来源:ITPUB博客 阅读:177 作者:笑笑的小楠楠 栏目:关系型数据库
@echo off
set uname=%1%
set pword=%2%
echo %uname%
echo %pword%
echo @echo off>C:\createUser.sql
echo create temporary tablespace user_temp>>C:\createUser.sql
echo tempfile 'C:\app\Administrator\oradata\user_temp.dbf'>>C:\createUser.sql
echo size 50m>>C:\createUser.sql
echo autoextend on>>C:\createUser.sql
echo next 50m maxsize 20480m>>C:\createUser.sql
echo extent management local;>>C:\createUser.sql
echo create tablespace user_data>>C:\createUser.sql
echo logging>>C:\createUser.sql
echo datafile 'C:\app\Administrator\oradata\user_data.dbf'>>C:\createUser.sql
echo size 50m>>C:\createUser.sql
echo autoextend on>>C:\createUser.sql
echo next 50m maxsize 20480m>>C:\createUser.sql
echo extent management local;>>C:\createUser.sql
echo create user %uname% identified by %pword%>>C:\createUser.sql
echo default tablespace user_data>>C:\createUser.sql
echo temporary tablespace user_temp;>>C:\createUser.sql
echo grant connect,resource,dba to %uname%;>>C:\createUser.sql
echo exit;>>C:\createUser.sql

echo @echo off>C:\createTable.sql
echo CREATE TABLE DEPT>>C:\createTable.sql
echo (DEPTNO NUMBER(2) CONSTRAINT PK_DEPT PRIMARY KEY,>>C:\createTable.sql
echo DNAME VARCHAR2(14),>>C:\createTable.sql
echo LOC VARCHAR2(13));>>C:\createTable.sql
echo INSERT INTO DEPT VALUES(1,'IT','XIAN');>>C:\createTable.sql
echo INSERT INTO DEPT VALUES(2,'core','XIAN');>>C:\createTable.sql
echo INSERT INTO DEPT VALUES(3,'wireless','XIAN');>>C:\createTable.sql
echo COMMIT;>>C:\createTable.sql
echo exit;>>C:\createTable.sql

sqlplus / as sysdba @C:\createUser.sql 

sqlplus %uname%/%pword%@orcl @C:\createTable.sql
exit 0
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI