Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8533

Re: Is there any way i can make ase to put something in errorlog when the one of the db is dropped

$
0
0

I don't know of any way to have ASE automatically log that to the errorlog.

 

If this is a general ongoing requirement, I'd recommend using the auditing features.

 

To show it historically, the transaction log in the master database can provide proof (assuming you weren't using a shared login).   When you drop a database, ASE logs a BEGINXACT log record that has a transaction name of $dbdestroy <databasename>.  The record also contains the suid of the user and a datetimestamp.

 

dbcc log(dbid,0,0,0,number of records to print,0)

The final 0 is the filter for BEGINXACT record types, which has an op code of 0.

 

 

Example

 

1> create database x
2> go
CREATE DATABASE: allocating 1536 logical pages (24.0 megabytes) on disk 'master'
(1536 logical pages requested).
Database 'x' is now online.
1> drop database x
2> go
1> set switch on 3604
2> go
Switch 3604 ('print_output_to_client') is turned on.
All supplied switches are successfully turned on.
1> dbcc log(1,0,0,0,1000,0)
2> go
LOG SCAN DEFINITION:
        Database id : 1
        Log operation type BEGINXACT (0)
        Forward scan: starting at beginning of log for 1000 log records
        Maximum of 1000 log records.

LOG RECORDS: (0 records did not qualify so far.)

 

        BEGINXACT       (4054,1)        sessionid=4054,1
        attcnt=1 rno=1 op=0 padlen=6 len=72
        odc_stat=0x0000 (0x0000)
        loh_status: 0x0 (0x00000000)
        masterxsid=(invalid sessionid)
        xstat=XBEG_ENDXACT,
        spid=17 suid=1 uid=1 masterdbid=0 dtmcord=0
        name=$dmpxact   time=Mar  5 2015  9:26:25:270AM

 

        BEGINXACT       (4054,11)       sessionid=4054,11
        attcnt=1 rno=11 op=0 padlen=5 len=64
        odc_stat=0x0000 (0x0000)
        loh_status: 0x0 (0x00000000)
        masterxsid=(invalid sessionid)
        xstat=XBEG_ENDXACT,
        spid=17 suid=1 uid=1 masterdbid=0 dtmcord=0
        name=x   time=Mar  5 2015  9:26:53:280AM

 

        BEGINXACT       (4054,19)       sessionid=4054,19
        attcnt=1 rno=19 op=0 padlen=2 len=72
        odc_stat=0x0000 (0x0000)
        loh_status: 0x0 (0x00000000)
        masterxsid=(invalid sessionid)
        xstat=XBEG_ENDXACT,
        spid=17 suid=1 uid=1 masterdbid=0 dtmcord=0
        name=$dbdestroy x   time=Mar  5 2015  9:26:57:280AM


Total number of log records 3 qualified out of 3 scanned.
DBCC execution completed. If DBCC printed error messages, contact a user with
System Administrator (SA) role.

 

So the third BEGINXACT record output here shows that suid 1 ("sa", that is me), destroyed (dropped) database named  "x" at 9:26AM

 

Cheers,

-bret


Viewing all articles
Browse latest Browse all 8533

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>