Learn Sybase ASE 12.5

xiaoxiao2021-03-06  111

1. Construction, users, library ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------- DDL for DatabaseDevice 'mydb001' ------- -------------------------------------------------- -------------------- Print 'mydb001'

Use mastergo

Disk init name = 'mydb001', physname = 'g: /ase1252/data/mydb001.dat' ,size =' 200m ', cntrltype = 0go

sp_deviceattr 'MyDB001', DSYNC, TRUEGO

-------------------------------------------------- ---------------------------

- DDL for DatabaseDevice 'mydb001_log'

-------------------------------------------------- ---------------------------

Print 'mydb001_log'

Use master

Go

Disk init name = 'mydb001_log',

PhysName = 'g: /ase1252/data/mydb001_log.dat',

Size = '100m',

CNTRLTYPE = 0

Go

sp_deviceattr 'mydb001_log', DSYNC, TRUE

Go

-------------------------------------------------- ---------------------------

- DDL for login 'na'

-------------------------------------------------- ---------------------------

Print 'Na'

EXEC SP_ADDLOGIN 'NA', 'Password', @ Defdb = 'mydb001', @ deflanguage = 'us_english', @fullname = 'nax', @AUTH_MECH = 'ASE'

EXEC SP_LOCKLOGIN 'NA', 'UNLOCK'

Go

-------------------------------------------------- ---------------------------

- DDL for Database 'mydb001'

-------------------------------------------------- ---------------------------

Print 'mydb001'

Go

Use master

Go

Create Database MYDB001 ON MYDB001 = 200

LOG ON MYDB001_LOG = 100

Go

-------------------------------------------------- ----------------------------- Dependent Ddl for Object (s)

-------------------------------------------------- ---------------------------

Use mydb001

Go

EXEC SP_CHANGEDBOWNER 'SA'

Go

EXEC MASTER.DBO.SP_DBOPTION MYDB001, 'SELECT INTO / BULKCOPY', TRUE

Go

EXEC MASTER.DBO.SP_DBOPTION MYDB001, 'TRUNC LOG ON Chkpt', True

Go

EXEC MASTER.DBO.SP_DBOPTION MYDB001, 'Abort TRAN ON LOG FULL', TRUE

Go

Checkpoint

Go

2. Construction

-------------------------------------------------- ---------------------------- DDL for Table'mydb001.dbo.aaa '----------- -------------------------------------------------- ---------------- Print 'Creating Table MyDB001.DBo.Aaaa'go

Use mydb001go

Setuser 'DBO'GO

create table aaa (name sysname (30) not null, id int not null, uid int not null, type char (2) not null, userstat smallint not null, sysstat smallint not null, indexdel smallint not null, schemacnt smallint not null, Sysstat2 Int Not Null, CRDATE DATIME NOT NULL, Expdate DateTime Not Null, Deltrig Int Not Null, Instrig Int not null, updtrig int not null, seltrig int not null, ckfirst int not null, cache smallint not null, audflags int null, objspare int not null, versionts binary (12) null, loginame varchar (30) null) lock allpages on ' Default'goseetusergo

3. DBCC TABLE

-------------------------------------------------- ------------- - mydb001.dbo.aaa check consistency messages from server ------------------------- ---------------------------------------- DBCC CheckTable ('mydb001.dbo. aaa ') - Checking mydb001.dbo.aaa: Logical pagesize is 2048 bytesThe total number of data pages in this table is 2.Table has 27 data rows.DBCC execution completed If DBCC printed error messages, contact a user with System Administrator. (Sa) role .---- DBCC ReIndex ('mydb001.dbo.aaa') - checking aaa: logical pagesize is 2048 bytesthe table 'mydb001.dbo.aaa' HAS no indexes.dbcc execution completed. If DBCC Printed Error Messages, Contact A User With System Administrator (SA) Role.

---- dbcc fix_text ( 'mydb001.dbo.aaa') -. There are no TEXT pages in table mydb001.dbo.aaa to be updated.DBCC execution completed If DBCC printed error messages, contact a user with System Administrator ( SA) role.

---- DBCC Tablealloc ('Mydb001.dbo.aaa', Optimized, Nofix) - ************************************ **************************************************** Table: mydb001.dbo.aaa objid = 48000171indidiD = 0 first = 529 root = 530 sort = 0 Data level: 0. 2 Data pages allocated and 1 extents allocated.total # of eXtents = 1alloc page 512 (# = 1 Used pages = 3 ref pages = 3) Total (# of extent = 1 Used Pages = 3 Ref pages = 3) in this databaseDBCC Execution completed. If DBCC Printed Error Messages, Contact A User With System Administrator (SA) Role.

转载请注明原文地址:https://www.9cbs.com/read-125094.html

New Post(0)