成人午夜激情影院,小视频免费在线观看,国产精品夜夜嗨,欧美日韩精品一区二区在线播放

當(dāng)前位置:首頁(yè)>>開發(fā)編程>>數(shù)據(jù)庫(kù)>>新聞內(nèi)容
應(yīng)用程序中oracle數(shù)據(jù)庫(kù)備份和恢復(fù)
作者:posted 發(fā)布時(shí)間:2004-9-4 11:11:12 文章來(lái)源:cnblogs

昨天花了一個(gè)多小時(shí)寫的一個(gè)小東西,可能以前有很多人寫過(guò)了,不過(guò)還是放上來(lái)看看

備份,可以實(shí)現(xiàn)在應(yīng)用程序文件夾內(nèi)生成一個(gè)DataBaseBak文件夾,并把dmp文件按照時(shí)間來(lái)保存在這個(gè)文件夾內(nèi),我設(shè)的精度是分鐘,可以自行更改,異常寫入系統(tǒng)日志:

   string startpath = Application.StartupPath;
   DirectoryInfo di = new DirectoryInfo(startpath+"\\DataBaseBak");
   di.Create();
   string oraPath = Registry.LocalMachine.OpenSubKey("Software").OpenSubKey("Oracle").GetValue("ORACLE_HOME").ToString();
   System.Diagnostics.Process proc = new System.Diagnostics.Process();
   proc.EnableRaisingEvents = false;
   proc.StartInfo.FileName = oraPath +"\\bin\\EXP.exe";
   proc.StartInfo.Arguments = " username/password@servicename file="+di.FullName+"\\filename"+DateTime.Now.ToString("yyyy-MM-dd-HH-mm")+".dmp owner=username";
   proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
   this.Cursor = Cursors.WaitCursor;
   try
   {
    proc.Start();
    MessageBox.Show("數(shù)據(jù)庫(kù)備份成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
   }
   catch(Exception ee)
   {
    MessageBox.Show("數(shù)據(jù)庫(kù)備份失敗","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
    EventLog newLog=new EventLog();
    newLog.Source = "OracleErr";
    newLog.WriteEntry(ee.Message,System.Diagnostics.EventLogEntryType.Error);
   }
   finally
   {
    proc.Dispose();
   }

   this.Cursor = Cursors.Arrow;

恢復(fù),可以自動(dòng)定位到DataBaseBak文件夾,然后自行選擇需要的dmp文件,進(jìn)行恢復(fù),并將異常寫入系統(tǒng)日志:

OpenFileDialog selectDMPDialog = new OpenFileDialog();
   selectDMPDialog.InitialDirectory = Application.StartupPath + "
\\DataBaseBak";
   selectDMPDialog.Filter = "備份文件(*.dmp)|*.dmp";
   if(selectDMPDialog.ShowDialog() == DialogResult.OK)
   {
    string oraPath = Registry.LocalMachine.OpenSubKey("software").OpenSubKey("Oracle").GetValue("ORACLE_HOME").ToString();
    System.Diagnostics.Process proc = new System.Diagnostics.Process();
    proc.EnableRaisingEvents = false;
    proc.StartInfo.FileName = oraPath+"
\\bin\\IMP.exe";
    proc.StartInfo.Arguments = "
username/password@servicename file="+selectDMPDialog.InitialDirectory+"\\"+selectDMPDialog.FileName+" fromuser=username";
    proc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
    this.Cursor = Cursors.WaitCursor;
    try
    {
     proc.Start();
     MessageBox.Show("數(shù)據(jù)庫(kù)導(dǎo)入成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
    }
    catch(Exception ee)
    {
     MessageBox.Show("數(shù)據(jù)庫(kù)備份失敗","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
     EventLog newLog=new EventLog();
     newLog.Source = "OracleErr";
     newLog.WriteEntry(ee.Message,System.Diagnostics.EventLogEntryType.Error);
    }
    finally
    {
     proc.Dispose();
    }
    this.Cursor = Cursors.Arrow;


最新更新
·SQL Server 2005刪除用戶失敗
·SQL Server中刪除重復(fù)數(shù)據(jù)的
·經(jīng)典SQL語(yǔ)句大全
·SQL Server 2005與ASP.NET/A
·三種查看MySQL數(shù)據(jù)庫(kù)版本的方
·SQL Server 2005 Express 遠(yuǎn)
·啟用SQL Server 2005 Expres
·Windows下如何安裝或卸載MyS
·解決MySQL5數(shù)據(jù)庫(kù)連接超時(shí)問(wèn)
·清除SQL Server日志的兩種方
相關(guān)信息
畫心
愚愛
偏愛
火苗
白狐
畫沙
犯錯(cuò)
歌曲
傳奇
稻香
小酒窩
獅子座
小情歌
全是愛
棉花糖
海豚音
我相信
甩蔥歌
這叫愛
shero
走天涯
琉璃月
Nobody
我愛他
套馬桿
愛是你我
最后一次
少女時(shí)代
灰色頭像
斷橋殘雪
美了美了
狼的誘惑
我很快樂(lè)
星月神話
心痛2009
愛丫愛丫
半城煙沙
旗開得勝
郎的誘惑
愛情買賣
2010等你來(lái)
我叫小沈陽(yáng)
i miss you
姑娘我愛你
我們都一樣
其實(shí)很寂寞
我愛雨夜花
變心的玫瑰
犀利哥之歌
你是我的眼
你是我的OK繃
貝多芬的悲傷
哥只是個(gè)傳說(shuō)
丟了幸福的豬
找個(gè)人來(lái)愛我
要嫁就嫁灰太狼
如果這就是愛情
我們沒有在一起
寂寞在唱什么歌
斯琴高麗的傷心
別在我離開之前離開
不是因?yàn)榧拍畔肽?/a>
愛上你等于愛上了錯(cuò)
在心里從此永遠(yuǎn)有個(gè)你
一個(gè)人的寂寞兩個(gè)人的錯(cuò)
主站蜘蛛池模板: 周至县| 同仁县| 慈利县| 宜春市| 肥东县| 唐河县| 麟游县| 宁海县| 惠东县| 温泉县| 喜德县| 通辽市| 蚌埠市| 揭东县| 麟游县| 开封市| 隆德县| 扎兰屯市| 苗栗县| 左云县| 建湖县| 江油市| 叙永县| 邓州市| 霍州市| 奉贤区| 西安市| 泰兴市| 安达市| 潼南县| 灌阳县| 客服| 博兴县| 海原县| 龙海市| 渑池县| 株洲县| 项城市| 佛山市| 梁山县| 宝应县|