天天看點

如何備份資料庫的某張表_不使用任何工具教你如何備份資料庫表1.Sql Server2. Oracle 3種方法3.Mysql

我是一個java開發者,我的文章,沒有華麗的言辭,沒有666的版式,這些都是我自己工作中用到的解決方案,很多都是直接粘貼的源碼,在這裡與君分享。如果喜歡這裡文章可以關注我,我回繼續發的,謝謝你。
如何備份資料庫的某張表_不使用任何工具教你如何備份資料庫表1.Sql Server2. Oracle 3種方法3.Mysql

說明:條件1=1肯定成立,表示備份資料和表結構,1=2則不成立,隻備份表結構

1.Sql Server

select * into newtableName from oldTableName Where 1=1; 備份表結構和資料

select * into newtableName from oldTableName Where 1=2; 備份表結構

2. Oracle 3種方法

create table newTableName as select * from oldTableName where 1=1;備份表和資料

select * into newtableName from oldTableName Where 1=1; 備份表和資料

insert into newtableName select * from oldTableName Where 1=1; 備份表和資料

3.Mysql

create table newTableName as select * from oldTableName where 1=1;備份表和資料