從master裝置刪除臨時資料庫

來源:互聯網
上載者:User

首先以單使用者登陸

 

在windows平台,開啟控制台,管理工具,sqlserver服務啟動,雙擊,填上-m參數

 

原理是建立一個新的資料庫,然後從sysdatabases ,sysusages表裡刪除temdp資料庫,它的bdid是2。查出新資料庫的id,然後將建立的資料庫dbid改為2,新資料庫名字改為tempdb就ok了

 

建立新資料庫

> create database  newtmp on tempdb_data_one = 3

> go

 

應用交易處理,避免操作失敗,破壞sqlserver運行

begin tran

 go

 

刪除臨時資料庫

 delete sysusages where dbid = 2

 delete sysdatabases where dbid = 2

 go

 

查詢新的資料庫id

select dbid from sysdatabases where name ='newtmp'

 go

 

將新資料庫記錄修改為臨時資料庫

update sysdatabases set dbid = 2 where dbid= 5

 go

 rowaffected)

 update sysusages set dbid = 2 where dbid = 5

 go

 rowaffected)

 update sysdatabases set name = 'tempdb' wherename = 'newtmp'

 go

 rowaffected)

 select name,dbid from sysdatabases where name= 'tempdb'

 go

 

提交事務

commit tran

go

select name,dbid, from sysdatabases where name = ‘tempdb’

 

select * from sysusages where dbid = 2

 

/*測試修改是否正確,正確則提交,否則可用rollback回退*/

重啟服務,就ok了。

最後可以在sybase central查看是不是有些變化

或者使用命令列查看。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.