创建表空间

2015-02-24 21:50:29  访问(5905) 赞(0) 踩(0)

  • 
    
    create temporary tablespace canoe_temp 
    tempfile 'canoe_temp.dbf' 
    size 32m 
    autoextend on 
    next 32m maxsize 2048m 
    extent management local; 
    
    create tablespace canoe_data 
    logging 
    datafile 'canoe_data01.dbf' 
    size 32m 
    autoextend on 
    next 32m maxsize 2048m 
    extent management local; 
    
    
    create user canoe identified by canoe 
    default tablespace canoe_data 
    temporary tablespace canoe_temp; 
    
    
    grant connect,resource to canoe; 
    
    grant create view to canoe;
     
    
    

  • 名称 :
    参考输入:slowx
    密码 :
    参数输入:pwd4slowx
    输出脚本:
  • 
    
            /// <summary>
            /// Oracle生成创建表空间和用户并授权的脚本语句
            /// </summary>
            /// <param name="theName">名称</param>
            /// <param name="thePwd">密码</param>
            /// <returns></returns>
            public string OracleDBToolCreateTableSpaceScript
                (
                    string theName,
                    string thePwd
                )
            {
                if (theName == null)
                {
                    theName = "slowx";
                }
                else
                {
                    theName = theName.Trim();
                    if (theName.Length == 0)
                        theName = "slowx";
                }
    
                if (thePwd == null)
                {
                    thePwd = "slowx#pwd";
                }
                else
                {
                    thePwd = thePwd.Trim();
                    if (thePwd.Length == 0)
                        thePwd = "slowx#pwd";
                }
    
                return @"
    
    -- 创建临时表空间:" + theName + @"_temp --
    create temporary tablespace " + theName + @"_temp 
    tempfile '" + theName + @"_temp.dbf' 
    size 32m 
    autoextend on 
    next 32m maxsize 2048m 
    extent management local; 
    
    -- 创建表空间:" + theName + @"_data --
    create tablespace " + theName + @"_data 
    logging 
    datafile '" + theName + @"_data01.dbf' 
    size 32m 
    autoextend on 
    next 32m maxsize 2048m 
    extent management local; 
    
    -- 创建用户:" + theName + @" --
    create user " + theName + @" identified by " + thePwd + @" 
    default tablespace " + theName + @"_data 
    temporary tablespace " + theName + @"_temp; 
    
    -- 授权连接和资源权限给用户:" + theName + @" --
    grant connect,resource to " + theName + @"; 
    
    -- 授权view权限给用户:" + theName + @" --
    grant create view to " + theName + @";
    
    ";
                 
            }
    

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)