zoukankan      html  css  js  c++  java
  • 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:TABLESPACEPARK.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
    .....
    .....



  • 相关阅读:
    sprintf的用法
    sscanf
    Decode the tape
    poj 1579 Function Run Fun
    Where's Waldorf?
    uva Andy's First Dictionary
    UVA Hangman Judge
    UVa Automatic Editing
    界面设计规范
    web标准下的web开发流程思考
  • 原文地址:https://www.cnblogs.com/gavanwanggw/p/6959094.html
Copyright © 2011-2022 走看看