天天看点

sysbase/oracle下创建用户及表方法

Oracle数据库

1.创建表空间hutao_charge

以下创建hutao_charge表空间的脚本中,1600M表示数据空间初始值,50M表示空间自动扩展值。当1600M空间用完后,会自动扩展,每一次扩展增加50M, 最大空间不受限。

connect hutao_smap/[email protected];
create tablespace hutao_charge
datafile '/hutaodata/hutao_file2/hutao_charge.dbf'
size 1600 M REUSE AUTOEXTEND ON NEXT 50 M MAXSIZE UNLIMITED DEFAULT
STORAGE ( INITIAL 64K NEXT 4M MINEXTENTS 1 MAXEXTENTS UNLIMITED PCTINCREASE 0);
commit;
           

2 创建用户和表空间

connect hutao_smap/[email protected];
drop user hutao_charge cascade ; 
create user hutao_charge identified by hutao_charge 
default tablespace hutao_charge 
temporary tablespace hutao_temp profile default ; 
grant connect to hutao_charge ; 
grant dba to hutao_charge ; 
drop user hutao_bill cascade ; 
create user hutao_bill identified by hutao_bill 
default tablespace hutao_charge 
temporary tablespace hutao_temp profile default ; 
grant connect to hutao_bill ; 
grant dba to hutao_bill ;
commit;
           

3 修改hutao_bill,hutao_charge用户的密码为hutao_smap

connect hutao_smap/[email protected];
alter user hutao_bill identified by hutao_smap;
alter user hutao_charge identified by hutao_smap;
commit
           

Sybase数据库

1 建立数据库hutao_charge和hutao_bill

use master
go
dump tran master with no_log
go
if exists(select name from master..sysdatabases where name = 'hutao_charge')
  drop database hutao_charge
go
if exists(select name from master..sysdatabases where name = 'hutao_bill')
  drop database hutao_bill
go

create database hutao_charge on hutaodatadev = 2000 log on hutaodatalog = 500
go

if exists(select name from master..sysdevices where name = 'hutao_charge_bak')
  exec sp_dropdevice hutao_charge_bak
go

exec sp_addumpdevice 'disk', 'hutao_charge_bak', '/data/hutao_charge_bak.dat'
go

create database hutao_bill on hutaodatadev = 2000 log on hutaodatalog = 500
go

if exists(select name from master..sysdevices where name = 'hutao_bill_bak')
  exec sp_dropdevice hutao_bill_bak
go

exec sp_addumpdevice 'disk', 'hutao_bill_bak', '/data/hutao_bill_bak.dat'
go
           

2 创建用户hutao_charge和hutao_bill

use hutao_charge
go

if not (exists (select 1 from master..syslogins where name = 'hutao_charge'))
begin
  exec sp_addlogin hutao_charge,hutao_charge,hutao_charge
end
go

if not exists (select 1 from dbo.sysusers where name = 'hutao_charge' and uid < 16382)
    exec sp_adduser hutao_charge
go

use hutao_bill
go

if not (exists (select 1 from master..syslogins where name = 'hutao_bill'))
begin
  exec sp_addlogin hutao_bill,hutao_bill,hutao_bill
end
go

if not exists (select 1 from dbo.sysusers where name = 'hutao_bill' and uid < 16382)
    exec sp_adduser hutao_bill
go
           

3 修改hutao_bill,hutao_charge用户的密码为hutao_smap

用hutao_bill/hutao_bill登录

exec sp_password hutao_bill(用户名), hutao_smap(密码), hutao_bill
go
           

用hutao_charge/hutao_charge登录

exec sp_password hutao_charge, hutao_smap, hutao_charge
go