首页 > 代码库 > oracle 数据库批处理文件

oracle 数据库批处理文件

文件夹结构

初始化脚本
 |----orcl_sql
	|----init_user.sql
	|----tab_home.sql
        |----TAB_USER.sql
 |----init.bat


init.bat

@echo off
@echo ---------------------------------------------------------------------
@echo ^|                                                                   ^|
@echo ^|               路边停车系统远程初始化数据库脚本工具                ^|
@echo ^|                                                                   ^|
@echo --------------------------------------------------------------------- 
@echo ^|
if exist orcl_sql/parmeter.sql (
	cd orcl_sql
	del -p parmeter.sql
	cd ..
)
set ip=127.0.0.1
set port=1521
set sid=orcl
set managerName=system
set password=admin
set newUserName=test
set newUserPWD=test
@echo ^|   ip : 127.0.0.1
@echo ^|   port : 1521
@echo ^|   sid : orcl
@echo ^|   managerName : system
@echo ^|   password : admin
@echo ^|   newUserName : test
@echo ^|   newUserPWD : test
rem set /p ip=^|   ip : 
rem set /p port=^|   port : 
rem set /p sid=^|   sid : 
rem set /p managerName=^|   managerName : 
rem set /p password=^|   password : 
rem set /p newUserName=^|   newUserName : 
rem set /p newUserPWD=^|   newUserPWD : 
@echo define userName=%newUserName%> orcl_sql/parmeter.sql
@echo define password=%newUserPWD%>> orcl_sql/parmeter.sql
@echo @orcl_sql/init_user.sql>> orcl_sql/parmeter.sql
if not exist C:\TABLESPACE (
	md C:\TABLESPACE
)
sqlplus %managerName%/%password%@%ip%:%port%/%sid% @orcl_sql/parmeter.sql
if exist orcl_sql/parmeter.sql (
	cd orcl_sql
	del -p parmeter.sql
	cd ..
)
sqlplus %newUserName%/%newUserPWD%@%ip%:%port%/%sid% @orcl_sql/tab_home.sql
@echo ^|                                                      
@echo ---------------------------------------------------------------------
@echo ^|                                                                   ^|
@echo ^|               路边停车系统远程初始化数据库脚本结束                ^|
@echo ^|                                                                   ^|
@echo --------------------------------------------------------------------- 
pause



init_user.sql

CREATE TABLESPACE TABLESPANCE_PARK 
DATAFILE 'C:\TABLESPACE\PARK.DBF' SIZE 1000M 
EXTENT MANAGEMENT LOCAL SEGMENT SPACE MANAGEMENT AUTO;     
CREATE USER &userName IDENTIFIED BY &password DEFAULT TABLESPACE TABLESPANCE_PARK;  
GRANT CREATE TABLE,CREATE VIEW,CREATE TRIGGER, CREATE SEQUENCE,CREATE PROCEDURE TO &userName;
GRANT UNLIMITED TABLESPACE TO &userName; 
GRANT CREATE SESSION TO &userName;
grant select on v_$statname to &userName;
grant select on v_$sesstat to &userName;
grant select on v_$session to &userName;
grant select on v_$mystat to &userName;
EXIT;

</pre><strong><span style="font-size:24px"></span></strong><pre name="code" class="plain">

tab_home.sql

@orcl_sql/TAB_USER.sql
@orcl_sql/TAB_ROLE.sql
@orcl_sql/TAB_MENU.sql
.....
.....



oracle 数据库批处理文件