Example 1: Defining a multifile database This example shows the definition of a database and storage areas for a multifile database. SQL> -- Note that there is no semicolon before SQL> -- the first CREATE STORAGE AREA clause. SQL> CREATE DATABASE ALIAS MULTIFILE_EXAMPLE cont> FILENAME 'DB_DATA01:[DB.DATA]MULTIFILE_EXAMPLE' cont> CREATE STORAGE AREA EMPID_LOW cont> FILENAME 'DB_DATA02:[DB.DATA]EMPID_LOW' cont> ALLOCATION IS 10 PAGES cont> -- Notice that the snapshot file resides on a cont> -- different disk than the storage area file. This cont> -- strategy reduces disk input/output bottlenecks: cont> SNAPSHOT FILENAME 'DB_SNAP03:[DB.SNAP]EMPID_LOW' cont> SNAPSHOT ALLOCATION IS 10 PAGES cont> -- cont> CREATE STORAGE AREA EMPID_MID cont> FILENAME 'DB_DATA04:EMPID_MID' cont> ALLOCATION IS 10 PAGES cont> SNAPSHOT FILENAME 'DB_SNAP05:[DB.SNAP]EMPID_MID' cont> SNAPSHOT ALLOCATION IS 10 PAGES cont> -- cont> CREATE STORAGE AREA EMPID_OVER cont> FILENAME 'DB_DATA06:[DB.DATA]EMPID_OVER' cont> ALLOCATION IS 10 PAGES cont> SNAPSHOT FILENAME 'DB_SNAP07:[DB.SNAP]EMPID_OVER' cont> SNAPSHOT ALLOCATION IS 10 PAGES cont> -- cont> CREATE STORAGE AREA HISTORIES cont> FILENAME 'DB_DATA02:[DB.DATA]HISTORIES' cont> ALLOCATION IS 10 PAGES cont> SNAPSHOT FILENAME 'DB_SNAP03:[DB.SNAP]HISTORIES' cont> SNAPSHOT ALLOCATION IS 10 PAGES cont> -- cont> CREATE STORAGE AREA CODES cont> FILENAME 'DB_DATA04:[DB.DATA]CODES' cont> ALLOCATION IS 10 PAGES cont> SNAPSHOT FILENAME 'DB_SNAP05:[DB.SNAP]CODES' cont> SNAPSHOT ALLOCATION IS 10 PAGES cont> -- cont> CREATE STORAGE AREA EMP_INFO cont> FILENAME 'DB_DATA08:[DB.DATA]EMP_INFO' cont> ALLOCATION IS 10 PAGES cont> SNAPSHOT FILENAME 'DB_SNAP09:[DB.SNAP]EMP_INFO' cont> SNAPSHOT ALLOCATION IS 10 PAGES cont> -- cont> -- End the CREATE DATABASE statement: cont> ; Example 2: This example shows how to set page-level and row-level locking on storage areas from both the database level and from the storage area level. SQL> CREATE DATABASE FILENAME sample cont> LOCKING IS PAGE LEVEL cont> -- cont> -- All storage areas will default to page-level locking unless cont> -- explicitly set to row-level locking. cont> -- cont> CREATE STORAGE AREA RDB$SYSTEM cont> FILENAME sample_system cont> -- cont> -- You cannot specify page-level locking on RDB$SYSTEM. RDB$SYSTEM cont> -- always defaults to row-level locking. cont> -- cont> CREATE STORAGE AREA HASH_AREA cont> FILENAME sample_hash cont> PAGE FORMAT IS MIXED cont> -- cont> -- HASH_AREA defaultS to page-level locking. cont> -- cont> CREATE STORAGE AREA DATA_AREA cont> FILENAME sample_data cont> LOCKING IS ROW LEVEL cont> -- cont> -- DATA_AREA is explicitly set to row-level locking. cont> -- cont> ; SQL> SHOW STORAGE AREAS (ATTRIBUTES) * Storage Areas in database with filename sample RDB$SYSTEM List storage area. Access is: Read write Page Format: Uniform Page Size: 2 blocks . . . Extent : Enabled Locking is Row Level HASH_AREA Access is: Read write Page Format: Mixed Page Size: 2 blocks . . . Extent : Enabled Locking is Page Level DATA_AREA Access is: Read write Page Format: Uniform Page Size: 2 blocks . . . Extent : Enabled Locking is Row Level See the SHOW statement for information on the SHOW STORAGE AREAS statement. Example 3: Creating and assigning a row cache to a storage area SQL> create database cont> filename SAMPLE_DB cont> reserve 2 cache slots cont> row cache is enabled cont> default storage area is AREA1 cont> create cache CACHE1 cont> cache size is 1000 rows cont> row length is 1000 bytes cont> create storage area AREA1 cont> cache using CACHE1 cont> ; SQL> show cache CACHE1 CACHE1 Cache Size: 1000 rows Row Length: 1000 bytes Row Replacement: Enabled Shared Memory: Process Large Memory: Disabled Window Count: 100 Working Set Count: 10 Reserved Rows: 20 Allocation: 100 blocks Extent: 100 blocks SQL> show storage area AREA1 AREA1 Access is: Read write Page Format: Uniform Page Size: 2 blocks Area File: USER_DISK:[DOC.DATABASES]AREA1.RDA;1 Area Allocation: 702 pages Extent: Enabled Area Extent Minimum: 99 pages Area Extent Maximum: 9999 pages Area Extent Percent: 20 percent Snapshot File: USER_DISK:[DOC.DATABASES]AREA1.SNP;1 Snapshot Allocation: 100 pages Snapshot Extent Minimum: 99 pages Snapshot Extent Maximum: 9999 pages Snapshot Extent Percent: 20 percent Locking is Row Level Using Cache CACHE1 Database objects using Storage Area AREA1: Usage Object Name Map / Partition ---------------- ------------------------------- ------------------------------- Default Area