• <sup id="my82s"><source id="my82s"></source></sup>
  • <legend id="my82s"><div id="my82s"></div></legend>
    <li id="my82s"><tt id="my82s"></tt></li>
    <bdo id="my82s"><rt id="my82s"></rt></bdo>
  • 查看: 6663|回复: 1

    [转载] ASM Dynamic Volume Manager and ASM Clustered File System

    [复制链接]
    论坛徽章:
    407
    紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
    跳转到指定楼层
    1#
    发表于 2009-9-12 20:32 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
    http://arup.blogspot.com/ author of http://www.oracle.com/technology ... features/index.html
    ASM Dynamic Volume Manager and ASM Clustered File System
    Two of the top features in 11gR2 are the ASM Dynamic Volume Manager (ADVM) and ASM Clustered File System (ACFS). What is the big deal about these two?

    ADVM allows you to create a volume from an ASM diskgroup. Here is an example where we created a volume called asm_vol1 of 100 MB on a diskgroup called DATA:


    ASMCMD [+] > volcreate -G DATA -s 100M asm_vol1


    Internally it issues the command


    alter diskgroup DATA add volume 'asm_vol1' size 100M;


    Now you enable the volume you just created:


    ASMCMD [+] > volenable -G DATA asm_vol1


    Internally it issues:
    alter diskgroup DATA enable volume 'asm_vol1';


    You can perform other commands like resize, delete, disable; but more on that later on a full length article.

    Now that the volume is created, what can you do with it. Well, like all volumes, you can create a filesystem on it. Here is an example of creating a FS called acfs1:


    [root@oradba2 ~]# mkdir /acfs1[root@oradba2 ~]# /sbin/mkfs -t acfs /dev/asm/asm_vol1-207mkfs.acfs: version                   = 11.2.0.1.0.0mkfs.acfs: on-disk version           = 39.0mkfs.acfs: volume                    = /dev/asm/asm_vol1-207mkfs.acfs: volume size               = 268435456


    Register MountPoint Command:


    [root@oradba2 ~]# /sbin/acfsutil registry -a -f /dev/asm/asm_vol1-207 /acfs1acfsutil registry: mount point /acfs1 successfully added to Oracle Registry


    If you get an error, use the force option:


    [root@oradba2 /]# /sbin/mkfs.acfs -f /dev/asm/asm_vol1-207mkfs.acfs: version                   = 11.2.0.1.0.0mkfs.acfs: on-disk version           = 39.0mkfs.acfs: volume                    = /dev/asm/asm_vol1-207mkfs.acfs: volume size               = 268435456mkfs.acfs: Format complete.



    Now you mount the the filesystem:


    [root@oradba2 /]# /bin/mount -t acfs /dev/asm/asm_vol1-207 /acfs1


    Now if you will check the filesystem, you will notice a new one - /acfs1


    [root@oradba2 /]# df -kFilesystem           1K-blocks      Used Available Use% Mounted on/dev/mapper/VolGroup00-LogVol00                     149313708  22429752 119176924  16% //dev/sda1               101086     11765     84102  13% /boottmpfs                   907628    591640    315988  66% /dev/shm/dev/asm/asm_vol1-207                        262144     37632    224512  15% /acfs1


    This new filesystem is actually carved out of the ASM diskspace. This can be used as a regular filesystem:


    [root@oradba2 /]# cd /acfs1[root@oradba2 acfs1]# lslost+found[root@oradba2 acfs1]# touch 1


    So, what't the big deal about it? Plenty.

    First, this is part of the ASM management; so all the bells and whistles of ASM - such as asynch i/o, etc. - applies to this filesystem.

    Second, this is now a "cluster" filesystem; it is visible across a cluster. So, now you have a fully functional generic filesystem visible across the cluster.

    Third, this is now protected by the Grid infrastructure, if you have installed it. Remember from my earlier posts that in 11gR2 you can now have a restartable grid infrastructure even on a single instance.

    More on ASM Dynamic Volume Manager later in a full length article. But I hope this makes you really interested.
    Labels: 11gR2 11g R2 11g Release 2 arup nanda new features



    # posted by Arup @ 12:57 AM 2 Comments  
    Wednesday, September 02, 2009
      
    Oracle 11g R2 Features
    Continuing on the previous posts, here is another gee-whiz feature of 11gR2 - the "deinstall" feature. Yes, that's right the deinstall one. Sometimes installations fail; sometimes you have to deinstall something to clean out the server for other use. Sometimes, I did, you have to clean out beta code to install production code. A deinstall utility stops all the processes, removes all the relevant software and components (such as diskgroups), updates all config files and make all necessary modifications to the other files. All these are done without you ever bothering about remnants that may cause issues later.

    You have to download the deinstall software from 11gR2 download from OTN. Choose "see all" to get to that software.

    Here is the demonstration of the deinstall utility:


    [oracle@oradba2 deinstall]$ ./deinstall -home /opt/oracle/product/11.2/grid1ORACLE_HOME = /opt/oracle/product/11.2/grid1Location of logs /opt/oracle/oraInventory/logs/############ ORACLE DEINSTALL & DECONFIG TOOL START #################################### CHECK OPERATION START ########################Install check configuration STARTChecking for existence of the Oracle home location /opt/oracle/product/11.2/grid1Oracle Home type selected for de-install is: SIHAOracle Base selected for de-install is: /opt/oracleChecking for existence of central inventory location /opt/oracle/oraInventoryChecking for existence of the Oracle Grid Infrastructure home /opt/oracle/product/11.2/grid1Install check configuration ENDTraces log file: /opt/oracle/oraInventory/logs//crsdc.logNetwork Configuration check config STARTNetwork de-configuration trace file location: /opt/oracle/oraInventory/logs/netdc_check22387.logSpecify all Oracle Restart enabled listeners that are to be de-configured [LISTENER]:Network Configuration check config ENDAsm Check Configuration STARTASM de-configuration trace file location: /opt/oracle/oraInventory/logs/asmcadc_check22388.logAutomatic Storage Management (ASM) instance is detected in this Oracle home /opt/oracle/product/11.2/grid1.ASM Diagnostic Destination : /opt/oracleASM Diskgroups : +DATA1,+FRA1Diskgroups will be droppedDe-configuring ASM will drop all the diskgroups and it's contents at cleanup time. This will affect all of the databases and ACFS that use this ASM instance(s).


    After some initial question and answer it shows a summary of activities and prompts you for a confirmation:


    ####################### CHECK OPERATION SUMMARY #######################Oracle Grid Infrastructure Home is: /opt/oracle/product/11.2/grid1The cluster node(s) on which the Oracle home exists are: (Please input nodes seperated by ",", eg: node1,node2,...)nullOracle Home selected for de-install is: /opt/oracle/product/11.2/grid1Inventory Location where the Oracle home registered is: /opt/oracle/oraInventoryFollowing Oracle Restart enabled listener(s) will be de-configured: LISTENERASM instance will be de-configured from this Oracle homeDo you want to continue (y - yes, n - no)? [n]: yA log of this session will be written to: '/opt/oracle/oraInventory/logs/deinstall_deconfig2009-09-02_02-12-22-PM.out'Any error messages from this session will be written to: '/opt/oracle/oraInventory/logs/deinstall_deconfig2009-09-02_02-12-22-PM.err'


    After you press "y", it starts the operation of a clean deinstallation. The output continues as shown below:


    ######################## CLEAN OPERATION START ########################ASM de-configuration trace file location: /opt/oracle/oraInventory/logs/asmcadc_clean22389.logASM Clean Configuration STARTASM deletion in progress. This operation may take few minutes.ASM Clean Configuration ENDNetwork Configuration clean config STARTNetwork de-configuration trace file location: /opt/oracle/oraInventory/logs/netdc_clean22390.logDe-configuring Oracle Restart enabled listener(s): LISTENERDe-configuring listener: LISTENER    Stopping listener: LISTENER    Listener stopped successfully.    Unregistering listener: LISTENER    Listener unregistered successfully.    Deleting listener: LISTENER    Listener deleted successfully.Listener de-configured successfully.De-configuring Listener configuration file...Listener configuration file de-configured successfully.De-configuring Naming Methods configuration file...Naming Methods configuration file de-configured successfully.De-configuring backup files...Backup files de-configured successfully.The network configuration has been cleaned up successfully.Network Configuration clean config END---------------------------------------->


    At some point you will be asked to shutdown cssd, etc. which need root privileges. The deinstall utility shows a comamnd string you can run as root to accomplish this task:


    Run the following command as the root user or the administrator on node "oradba2"./opt/oracle/software/11gR2/deinstall/perl/bin/perl -I/opt/oracle/software/11gR2/deinstall/perl/lib -I/opt/oracle/software/11gR2/deinstall/crs/install /opt/oracle/software/11gR2/deinstall/crs/install/roothas.pl -force  -delete -paramfile /opt/oracle/software/11gR2/deinstall/response/deinstall_Ora11g_gridinfrahome1.rspPress Enter after you finish running the above commands


    Running the command on a different terminal as root:


    [root@oradba2 ~]# /opt/oracle/software/11gR2/deinstall/perl/bin/perl -I/opt/oracle/software/11gR2/deinstall/perl/lib -I/opt/oracle/software/11gR2/deinstall/crs/install /opt/oracle/software/11gR2/deinstall/crs/install/roothas.pl -force  -delete -paramfile /opt/oracle/software/11gR2/deinstall/response/deinstall_Ora11g_gridinfrahome1.rsp2009-09-02 14:20:57: Checking for super user privileges2009-09-02 14:20:57: User has super user privileges2009-09-02 14:20:57: Parsing the host nameUsing configuration parameter file: /opt/oracle/software/11gR2/deinstall/response/deinstall_Ora11g_gridinfrahome1.rspCRS-2673: Attempting to stop 'ora.cssd' on 'oradba2'CRS-2677: Stop of 'ora.cssd' on 'oradba2' succeededCRS-4549: Stopping resources.CRS-2673: Attempting to stop 'ora.diskmon' on 'oradba2'CRS-2677: Stop of 'ora.diskmon' on 'oradba2' succeededCRS-4133: Oracle High Availability Services has been stopped.ACFS-9200: SupportedSuccessfully deconfigured Oracle Restart stack


    Now going back to the original terminal where deinstall was called from, press Enter. The output continues:


    Oracle Universal Installer clean STARTDetach Oracle home '/opt/oracle/product/11.2/grid1' from the central inventory on the local node : DoneDelete directory '/opt/oracle/product/11.2/grid1' on the local node : DoneThe Oracle Base directory '/opt/oracle' will not be removed on local node. The directory is in use by Oracle Home '/opt/oracle/product/10.2/db1'.The Oracle Base directory '/opt/oracle' will not be removed on local node. The directory is in use by central inventory.Oracle Universal Installer cleanup was successful.Oracle Universal Installer clean ENDOracle install clean STARTClean install operation removing temporary directory '/tmp/install' on node 'oradba2'Oracle install clean ENDMoved default properties file /opt/oracle/software/11gR2/deinstall/response/deinstall_Ora11g_gridinfrahome1.rsp as /opt/oracle/software/11gR2/deinstall/response/deinstall_Ora11g_gridinfrahome1.rsp1######################### CLEAN OPERATION END ################################################ CLEAN OPERATION SUMMARY #######################ASM instance was de-configured successfully from the Oracle homeFollowing Oracle Restart enabled listener(s) were de-configured successfully: LISTENEROracle Restart was already stopped and de-configured on node "oradba2"Oracle Restart is stopped and de-configured successfully.Successfully detached Oracle home '/opt/oracle/product/11.2/grid1' from the central inventory on the local node.Successfully deleted directory '/opt/oracle/product/11.2/grid1' on the local node.Oracle Universal Installer cleanup was successful.Oracle install successfully cleaned up the temporary directories.#################################################################################### ORACLE DEINSTALL & DECONFIG TOOL END #############


    The components are cleanly deinstalled now. The directories have been cleaned up by this tool.

    This was available in 11gR1 as well; but R2 just makes it very user friendly.

    More on this later.
    Labels: 11gR2 11g R2 11g Release 2 arup nanda new features



    # posted by Arup @ 4:34 PM 1 Comments  
    Tuesday, September 01, 2009
      
    Oracle 11g Release 2 is Finally Out
    Finally, it's that time again - the birth of a new versionof Oracle - 11g Release 2. Being Release 2, it does not have as much bells and whistles as the 11g.

    I downloaded it immediately and started installation. Some of the gee-whiz features of this release are:

    (1) Editions
    (2) ASM Filesystem
    (3) Oracle Restart
    (5) Columnar Compression

    I have been beta testing this for some time; so I had seen previews of the release. Continuing the previous serieses, I will write the new features series for 11gR2 on OTN as well - it will be a 11 part series.

    A little bit about Oracle Restart. It adds a lightweight clusterware functionality to a single instance database. If the instance crashes, OR brings it up, monitors it ans so on. And by the way, this is called "Grid Infrastructure". So you have to install two Oracle Homes - one each for grid and the rdbms.

    When there is Grid, there is srvctl, of course. The grid infrastructure comes with srvctl. Here is how you check what is running from a specific Oracle Home:

    oracle@oradba1 ~# srvctl status home -o /opt/oracle/product/11gR2/db1 -s state.txt
    Database d112d1 is running on node oradba1

    The above command create a file called state.txt.

    oracle@oradba1 ~# cat state.txt
    db-d112d1

    It shows the database name - D112D1.

    This is done on a single instance Oracle database; not a cluster. But the grid infrastructure looks and feels like a cluster. Here are some more commands to check status:

    oracle@oradba1 ~# srvctl status listener
    Listener LISTENER is enabled
    Listener LISTENER is running on node(s): oradba1
    oracle@oradba1 ~# srvctl status asm -a
    ASM is running on oradba1
    ASM is enabled.

    A bunch of new processes suppor this grid infrastructure:


    oracle   19046     1  0 18:13 ?        00:00:03 /opt/oracle/product/11gR2/grid1/bin/ohasd.bin rebootoracle 19487 1 0 18:15 ? 00:01:14 /opt/oracle/product/11gR2/grid1/bin/oraagent.binoracle 19502 1 0 18:15 ? 00:00:01 /opt/oracle/product/11gR2/grid1/bin/tnslsnr LISTENER -inheritoracle 19656 1 0 18:15 ? 00:00:01 /opt/oracle/product/11gR2/grid1/bin/cssdagentoracle 19658 1 0 18:15 ? 00:00:02 /opt/oracle/product/11gR2/grid1/bin/orarootagent.binoracle 19674 1 0 18:15 ? 00:00:01 /opt/oracle/product/11gR2/grid1/bin/ocssd.binoracle 19687 1 0 18:15 ? 00:00:00 /opt/oracle/product/11gR2/grid1/bin/diskmon.bin -d -f


    Let's see what happens when you kill the instance.


    oracle@oradba1 ~# ps -aefgrep pmonoracle   14225 13768  0 23:15 pts/7    00:00:00 grep pmonoracle   19866     1  0 18:16 ?        00:00:00 asm_pmon_+ASMoracle   26965     1  0 20:53 ?        00:00:00 ora_pmon_D112D1oracle@oradba1 ~# kill -9 26965


    This will, of course, crash the instance. Let's chck after some time:


    oracle@oradba1 ~# ps -aef|grep pmonoracle   14315     1  0 23:15 ?        00:00:00 ora_pmon_D112D1oracle   14686 11492  0 23:17 pts/2    00:00:00 grep pmonoracle   19866     1  0 18:16 ?        00:00:00 asm_pmon_+ASM


    Where did the pmon come from? Didn't the instance just crash?

    The instance was restarted by Oracle Restart.

    What if you want to just keep the instance down, e.g. during a maintenance. Well, just shutdown normally; the instance will stay down. When you are ready, start the instance using either SQL*Plus or srvctl:

    oracle@oradba1 ~# srvctl start database -d d112d1

    Remember, D112D1 is a single instance database.

    More on this later, on OTN.
    Labels: 11gR2 11g R2 11g Release 2 arup nanda new features
    论坛徽章:
    407
    紫蛋头
日期:2012-05-21 10:19:41迷宫蛋
日期:2012-06-06 16:02:49奥运会纪念徽章:足球
日期:2012-06-29 15:30:06奥运会纪念徽章:排球
日期:2012-07-10 21:24:24鲜花蛋
日期:2012-07-16 15:24:59奥运会纪念徽章:拳击
日期:2012-08-07 10:54:50奥运会纪念徽章:羽毛球
日期:2012-08-21 15:55:33奥运会纪念徽章:蹦床
日期:2012-08-21 21:09:51奥运会纪念徽章:篮球
日期:2012-08-24 10:29:11奥运会纪念徽章:体操
日期:2012-09-07 16:40:00
    2#
     楼主| 发表于 2009-9-12 20:37 | 只看该作者

    also from his blog

    Ultra-Fast MV Alteration using Prebuilt Table Option
    Here is an interesting question posed to me one time and I had found a solution. After 9 years, I encountered the same question and was shocked to find that many people still don't know about a little trick that could avoid a potential problem later.



    Someone asked me how to modify a column of a Materialized View, e.g. from varchar2(20) to varchar2(25), or something similar. Drop and recreate? Not an option. We are talking about a several hundred GB MV with a very complex query that will take days to complete.

    Problem
    When you alter a materialized view to add a column or modify a column definition, unfortunately there is no command functionally equivalent to ALTER MATERIALIZED VIEW … ADD COLUMN. The only way to alter an MV is to completely drop and recreate it with the alteration. That approach may be acceptable for small MVs; but for larger MVs the cost of rebuilding can make the process quite infeasible. In addition to the time it will take to rebuild the entire MV (which could be days, depending on the size), the redo/undo generation and the surge in logical I/O due to the MV query may seriously affect the performance of the source database. In some cases, large MVs may even fail to be rebuilt as sometimes the undo segments may not have the undo information for long running queries – causing ORA-1555 errors.

    So is there a better approach? Yes, there is. In this document I am going to explain a better approach for creating an MV that makes the alterations possible without rebuilding the MV – a task accomplished in mere seconds as opposed to potentially days.

    Concept of Segments

    Segments are stored units in Oracle. So, a table has a segment; not a view – since the contents of the view are not stored; only the view definition is. A Materialized View, however, stores the contents; so it is a segment.

    Actually, the concept of segment goes a little bit further. If the table is partitioned, then each partition is a different segment. So, the relationship between tables and segments is one-to-many.

    When you create an object that needs storage, such as a table, an MV or an index, Oracle first creates the corresponding segment. Once that is complete, the segment is shrouded by the cover of the object. The segment still continue to exist; but is now connected to the object. Until the segment is completely created and populated, the object technically does not exist. The segment may, in some cases, have a different name from the object. If the segment creation (or population) fails, Oracle automatically cleans up the remnants of the failed segment; but sometimes it may not be, leaving behind the chards that are eventually cleaned up by SMON process.

    MVs and Segments

    Anyway, how is this discussion about segments relevant to our objective here –the fast alteration of MViews?

    Plenty. Remember, MVs are nothing but tables behind the covers? Property-wise, MVs and tables are like sisters, not even cousins. You can think of MVs are regular tables with some built in intelligence about how they were created (the defining query), how often they should be refreshed automatically by a job and how queries should be transformed to take advantage of the presence of the MVs. But apart from that, there is not much difference. You can directly insert into an MV, create indexes and so on. As far as a segment is concerned, there is no difference between an MV and a table. In fact Oracle stores the segment as a table:

    SQL> select SEGMENT_TYPE
    2 from user_segments
    3 where SEGMENT_NAME = 'MV1';

    SEGMENT_TYPE
    ------------------
    TABLE

    However, the biggest difference is the very issue we are discussing – you can’t add/modify columns of an MV while you can do that freely for a table. If I could attempt to logically represent tables and MVs, here is how it would look like.





    The segment is the same. If it was created as an MV, the properties of MV take over the segment. If it was created as a table, the properties of a table take over the control.

    Prebuilt Table

    Since under the covers the segment is the same for both MV and table, can’t you take advantage of the fact? Suppose you have a table and you now want to convert that to an MV. In other words, you want to repoint that arrow initially pointed at the table to the MV properties:




    Can you do it? Yes, of course you can. Since at the segment level it is the same, Oracle allows you to do it. When you create an MV, you can use a special clause ON PREBUILT TABLE. Here is how you create a MV in the regular approach:

    create materialized view mv1
    never refresh as
    select cast(count (1) as number(10)) cnt from t1;

    If you check the objects created:

    SQL> select object_id, data_object_id, object_type
    2 from user_objects
    3 where object_name = 'MV1';

    OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
    ---------- -------------- -------------------
    74842 74842 TABLE
    74843 MATERIALIZED VIEW

    So, it creates two objects – a table and an MV - anyway. Note a very important difference though: the DATA_OBJECT_ID for the MV object is null. If you drop the MV and check for the objects:

    SQL> drop materialized view mv1;

    Materialized View dropped.

    SQL> select object_id, data_object_id, object_type
    2 from user_objects
    3 where object_name = 'MV1';

    no rows selected

    Even though there were two objects – a table and an MV, when you dropped the MV, both were dropped. The table object didn’t have an independent existence. Dropping the MV drops the table automatically.

    Now, in the modified approach, you first create the table in the same name as the MV you are going to create:

    SQL> create table mv1 (cnt number(10));

    Next you create the MV by adding a new clause called ON PREBUILT TABLE shown below:

    create materialized view mv1
    on prebuilt table
    never refresh
    as
    select cast(count (1) as number(10)) cnt from t1;

    Now there will be two objects as well – one table and one MV. The MV simply took over the command over the segment but since the table already existed, it did not recreate the table object. So there are still only 2 objects.

    One concern: since you created the table manually, can you accidentally drop it? Let’s see:

    SQL> drop table mv1;
    drop table mv1
    *
    ERROR at line 1:
    ORA-12083: must use DROP MATERIALIZED VIEW to drop "ARUP"."MV1"

    That answers it. The table simply loses its independent existence. However, see what happens when you drop the MV:

    SQL> DROP MATERIALIZED VIEW mv1;

    Materialized view dropped.

    Now check the segment:

    SQL> select segment_type
    2 from user_segments
    3 where segment_name = 'MV1';

    SEGMENT_TYPE
    ------------------
    TABLE

    The segment still exists! When you dropped the MV, the segment was not dropped; it simply reverted to being a table. You can confirm that by checking the objects view:

    OBJECT_ID DATA_OBJECT_ID OBJECT_TYPE
    ---------- -------------- -------------------
    77432 77432 TABLE

    Voila! The object still exists as a table. Previously you saw dropping the MV removed all the objects and the segment. However, in this approach the segment was preserved. Since it reverted to a table, you can do all things possible in a table – select from it, create index, and - most important – modify the column. You can alter the column to make NUMBER(11).

    SQL> alter table mv1 modify (cnt number(11));

    Table altered.

    Now, create the MV again:

    create materialized view mv1
    on prebuilt table
    never refresh as
    select cast(count (1) as number(11)) cnt from t1;

    That’s it. The MV is altered. The whole process took about a few seconds, and since you didn’t have to recreate the segment, you saved enormous load on the database. Here a schematic representation of what happened.




    Now you know how powerful prebuilt table option is. It only affects how you define the MV; nothing else. All other properties of the MV remain intact. The end users don’t even know about the prebuilt table option; but for the DBA it remains a powerful tool in the arsenal. As a best practice I recommend creating any MV, regardless of size, with the ON PREBUILT TABLE clause. In small tables you probably don’t see a huge advantage; but what if today’s small table grows to a large one tomorrow? It’s better to be safe than sorry.

    Conversion to the New Approach

    Now that you understand the power of the prebuilt option, you may be wondering how to convert the existing MVs to the new clause. Unfortunately there is no conversion path. You have to drop and recreate the MVs. That is why this time – when we are moving MVs to new tablespaces – we have the golden opportunity.

    One approach is to create new tables with new names and then rename them. Here are the steps:

    1. Create a table with nologging clause from the old MV
    create table new_mv1
    nologging
    as
    select * from mv1;

    2. Capture the MV definition from the data dictionary:

    select dbms_metadata.get_ddl ('MATERIALIZED_VIEW','MV1')
    from dual ;

    DBMS_METADATA.GET_DDL('MATERIALIZED_VIEW','MV1')
    ------------------------------------------------
    CREATE MATERIALIZED VIEW "ARUP"."MV1" ("CNT")
    ORGANIZATION HEAP PCTFREE 10
    … and so on …

    3. Spool this to a file to be executed later.

    4. Edit this file to place ON PREBUILT TABLE CLAUSE.

    CREATE MATERIALIZED VIEW "ARUP"."MV1" ("CNT")
    ORGANIZATION HEAP ON PREBUILT TABLE PCTFREE 10

    5. Take a Data Pump export with CONTENTS=METADATA_ONLY option. This creates all relevant privileges on the export dump file. Keep it aside.

    6. Drop the Materialized View MV1.

    7. Rename table NEW_MV1 to MV1

    8. Execute the script you created earlier to recreate the MV.

    9. Import the export dump file. It will recreate all the privileges.

    This is slow; but the best approach since it generates minimum amount of redo and undo.

    Hope this is helpful. You may look at an article I wrote http://www.dbazine.com/oracle/or-articles/nanda2 The article describes, with complete code, how to alter an MV where the refresh occurs across databases.

    使用道具 举报

    回复

    您需要登录后才可以回帖 登录 | 注册

    本版积分规则 发表回复

    TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
      ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
      ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
    CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
    京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
      
    快速回复 返回顶部 返回列表
    亚洲三级理论
  • <sup id="my82s"><source id="my82s"></source></sup>
  • <legend id="my82s"><div id="my82s"></div></legend>
    <li id="my82s"><tt id="my82s"></tt></li>
    <bdo id="my82s"><rt id="my82s"></rt></bdo>