乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Oracle 快速創(chuàng)建 N 個表空間數(shù)據(jù)文件

       LuciferLiu 2021-12-10

      Oracle 數(shù)據(jù)庫是由無數(shù)個表空間組成,表空間是由無數(shù)個數(shù)據(jù)文件組成,數(shù)據(jù)文件存放在磁盤中。

      隨著時間和業(yè)務(wù)量的增長,數(shù)據(jù)文件會不斷的增長,默認的數(shù)據(jù)文件一個為 32G,因此,需要不斷的新增數(shù)據(jù)文件!

      那么,問題來了!需要新增很多數(shù)據(jù)文件怎么辦?

      以下示例以 LUCIFER 表空間進行演示!默認開啟 OMF!

      ?? 如何開啟 OMF 請參考:Oracle OMF參數(shù)

      1、新增一個數(shù)據(jù)文件,小意思,一行命令搞定!

      alter tablespace LUCIFER add datafile size 30G autoextend off;
      

      2、新增 10 個數(shù)據(jù)文件,麻煩點,復制 10 行也能搞定!

      alter tablespace LUCIFER add datafile size 30G autoextend off;
      alter tablespace LUCIFER add datafile size 30G autoextend off;
      alter tablespace LUCIFER add datafile size 30G autoextend off;
      alter tablespace LUCIFER add datafile size 30G autoextend off;
      alter tablespace LUCIFER add datafile size 30G autoextend off;
      alter tablespace LUCIFER add datafile size 30G autoextend off;
      alter tablespace LUCIFER add datafile size 30G autoextend off;
      alter tablespace LUCIFER add datafile size 30G autoextend off;
      alter tablespace LUCIFER add datafile size 30G autoextend off;
      alter tablespace LUCIFER add datafile size 30G autoextend off;
      

      3、新增 100 個數(shù)據(jù)文件,頭疼,復制 100 行?那 1000 個呢?10000個呢?

      當然,只是打個比方,無需較真,只是為了說明一個理念!

      像這種需要一次性增加多個表空間數(shù)據(jù)文件的,可以直接通過循環(huán)語句,短短幾行代碼就可以搞定:

      begin
        for i in 1 .. 100 loop
          execute immediate 'alter tablespace LUCIFER add datafile size 30G autoextend off';
        end loop;
      end;
      /
      

      通過以上短短的代碼,就可以實現(xiàn)創(chuàng)建 100 個數(shù)據(jù)文件,如果需要 10000 個,就把 100 改成 10000 就行了!

      如果你說你不使用 OMF 參數(shù),當然可以,稍微改一下就行:

      begin
        for i in 1 .. 100 loop
          execute immediate 'alter tablespace LUCIFER add datafile ''/oradata/orcl/lucifer'||i||'.dbf'' size 30G autoextend off';
        end loop;
      end;
      /
      

      只需要將數(shù)據(jù)文件路徑 /oradata/orcl/ 和 數(shù)據(jù)文件名稱 lucifer 拼接以下,然后傳入 i 作為編號即可!

      ?? 記住,本文講的是一個技巧,也是一個理念,不要鉆牛角尖!


      本次分享到此結(jié)束啦~

      如果覺得文章對你有幫助,點贊、收藏、關(guān)注、評論,一鍵四連支持,你的支持就是我創(chuàng)作最大的動力。

        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多