Vous êtes sur la page 1sur 10

TABLE SPACE ADMINISTRATION

SAPDBA: Tablespace Administration
       Check/alter tablespace
   a   ­ Tablespace
   b   ­ Log checks
   c   ­ Freespace and fragmentation of all tablespaces
   d   ­ Check free space of objects in all tablespaces
   e   ­ Check free space of objects in tablespace
   f   ­ Alter tablespace Add Datafile
   g   ­ Create tablespace
   h   ­ Display all tablespaces and datafiles
   i   ­ Display raw device drivers in /dev
   q   ­ Return
SAPDBA records the performed checks in log <timestamp>.ext, when you have set the Log
checks option to yes. See Setting the Log Checks Option [Page 50].
The extension of a tablespace or the creation of a new one is always logged.

Checking Tablespaces
You should check whether a tablespace needs to be extended, and distinguish between two
cases:
     •   The tablespace is highly fragmented.
         If the tablespace has sufficient free storage space, it is probably a fragmentation of free
         storage space which causes the storage problems. This will occur only if DROP
         operations are performed frequently. Database objects that are frequently deleted
         (dropped) and created anew should be separated.
         You can solve the storage problems by reorganizing the fragmented tablespace or the
         fragmented tables and indexes which it contains. An extension of the tablespace would
         then not be necessary.
         A reorganization is time­consuming and complicated, however. SAP therefore
         recommends that you extend the tablespace rather than reorganizing it. You should
         reorganize this tablespace only if one or more of the following conditions apply:
         –    The maximum number of data files for your system has been reached
         –    An extremely large number of extents has been assigned to very many objects in the
              corresponding tablespace
         –    Accessing the data in the tablespace causes performance problems
     See Limitations of the Database System [Page 579].
     •   The tablespace has too little free storage space.
         A full tablespace must always be extended.
If an extension of a tablespace causes your database to approach the limit value determined by
the operating system for the number of files, it can be useful to reorganize this tablespace after
an extension or to extend the tablespace during the reorganization. However, a reorganization is
not very likely necessary because the limit value for the data files is very high (at least 254 files
are available).

Freespace Statistics
Select Freespace and fragmentation of all tablespaces.
With these statistics you can see whether it is necessary to extend a tablespace or whether a
reorganization should be performed instead or in addition. Check the following information:
    •   Allocated and % Alloc.: Reserved storage space in kilobytes and as a percentage
        of the tablespace size.
        When the utilization is more than 90 percent, you should extend the tablespace by
        adding a new data file.
        Please do not try to solve this problem by reorganizing the database. A reorganization
        defragments the complete storage space. This means that the fragmented used storage
        space and fragmented free storage space are put together, i.e., the storage space is
        reorganized, but no additional space is gained by this. In fact, additional space may
        even be required. Therefore, always extend a tablespace where there is little space left.
    •   Free areas (number of freespace areas) and Largest (size of the largest freespace
        area).
        If the percentage of the storage space used is relatively low, you should check these
        columns to see whether the storage problems in a tablespace are due to the
        fragmentation of free storage space.
        If the number of fragments is high and the largest fragment is small (smaller than 1 MB),
        the cause of the tablespace overflow is probably the fragmentation. It may be useful to
        reorganize the fragmented tablespace (or highly fragmented tables and indexes in it)
        instead of extending it. However, please note: Since enough data files are available, you
        can solve this problem by adding a new file. If possible, avoid reorganization because it
        is more complicated and time­consuming.

Check Functions
You can check whether (and which) tablespaces would overflow if an additional n extents were
assigned.
     •   Check free space for objects in all tablespaces
         Overflow check for all tablespaces. Displays a list of the tables for which assigning an
         additional n extents would cause the corresponding tablespace to overflow.
     •   Check free space for objects in tablespace
         Overflow check for one tablespace. Select Enter tablespace name and enter the name
         of the tablespace. Displays a list of the tables for which assigning an additional n extents
         would cause the corresponding tablespace to overflow.
Which Table or Index Caused the Overflow?
Occurrences of the ORACLE error (tablespace overflow) are recorded in the R/3 System log
(along with the table/index that was accessed).
You can then determine which tablespace the table/index belongs to ­ with SAPDBA, for example
­ using the function Check free space for objects in all tablespaces with test value 1.
Tablespace Overflow Threshold Values
     •   Overflow with next extent
         Extend the tablespace as soon as possible. Exception: the tablespaces PSAPPROTD/I
         contain SAP logs (from background processes and spool requests). Delete old log files
         and requests instead of extending these tablespaces.
     •   Overflow with the next two extents
         Monitor the tablespace.
     •   No overflow with the next two extents
         The tablespace currently has sufficient free storage space. No intervention is necessary,
         provided the tablespace continues to be used normally. Important: if you change the
         storage parameters or perform operations in the R/3 System that will fill this tablespace
         more quickly, you should monitor it as well.
Database Monitor
The database performance monitor of the R/3 System also provides information on how urgent a
tablespace extension is.
For more information, refer to the online help of the Computing Center Management System.

Files/Raw Devices of a Tablespace
The objects of a tablespace can be stored in files or in raw devices. SAPDBA can display this
assignment for you:
    •  Display all tablespaces and datafiles
       Display all tablespaces and datafiles displays the assignment between tablespace ­
       data files or tablespace ­ raw devices and the size of the files.
    •  Display all character devices in...
       Display all character devices in /dev (depending on the operating system) displays an
       overview of all the raw devices and their size. If data of your ORACLE database is in a
       raw device, the link to this raw device is also displayed.
See also SAPDBA Support for Raw Device Configuration [Page 767].

Extending a Tablespace
The R/3 System can be either active or closed when you extend a tablespace.
Do not shut down the database system if you want to add a data file to a tablespace.
1. Select Tablespace and enter the name of the tablespace you want to extend. Select Alter
   tablespace <tablespace name> Add data file. The following menu options are displayed,
   depending on whether you want to add a file (in file system) or a raw device (on raw device):
              File system                  Raw devices
        a ­ File system or raw device File system or raw device
                                           New data file
                                           name/Required raw device
                                           name
        b ­ File size                      Enter raw device name
        c ­ Select path                    Select raw device
        d ­ Alter suggested path           File size on raw device
        e ­ Display current files          Display current files
        s ­ Start (Add datafile)           Start (Add datafile)
        q ­ Return                         Return
        File system or raw device: SAPDBA displays whether you are working in a file system
        (file system) or on raw devices (raw device). At this time you can choose again between
        working in the file system or on raw devices. If you are working on raw devices, the
        ORACLE name of the raw device and the required raw device ID are displayed. See also
        SAPDBA Support for Raw Device Configuration [Page 767].
2. You can change the default values for the size and path of the new data file.
        File system:
       • File size: SAPDBA calculates the size of the new data file from the previous size of
            the tablespaces using one of the following percentages:
   –    Percentage from the SAPDBA profile (init<DBSID>.dba) if parameter
        tspadd_tspname is set for this tablespace.
   –    Default value: 30 percent of the tablespace size when no entry exists for this tablespace
        in the SAPDBA profile.
        See tspadd_tspname [Page 287] and Specifying the File Size [Page 689].
       • Select path: SAPDBA displays a list of all sapdata directories and highlights the
            directories that are already used by the tablespace and its corresponding D/I
            tablespace (used (<n> x), <n> number of files).
            You can decide which of the displayed sapdata directories you want to select. If you
            specify a different directory and this results in the files being moved to a different disk,

           this may (when the data and index tablespace are on the same disk) cause
           performance losses due to competing I/O accesses.
           See New Path [Page 692].
       • Alter suggested path: SAPDBA suggests a path for the data files according to the
           SAP naming conventions or displays the path which you selected with Select path .
           Only the first part of the complete target directory is suggested
           (<ORACLE_HOME>/sapdata<n>). The other part of the directory and the file name
           itself are defined according to the SAP naming conventions.
           See Naming Convention [Page 691].
           You can define another file name (see New Path [Page 692]). In this case SAPDBA
           checks whether there is sufficient storage space available in the file system which was
           suggested to store the new data file.
        Raw Device:
       • Enter raw device name:Enter the name of the required raw device. You can enter the
           complete path here. If you do not do so, the path defined under select raw device will
           be used.
           SAPDBA checks whether:
                  ­ the raw device exists
                  ­ ora<sapsid> is the owner
                  ­ an ORACLE file of <DB­name> resides there
                  ­ a file system (mounted) resides there.
           SAPDBA does not check whether the raw device is used by another application and
           whether the disk is partitioned and the partitions are reserved.
       • Select raw device in path: SAPDBA displays a list of the raw devices which can be
           used to extend the tablespace (owner: ora<sapsid>, CAUTION: It is up to the
           database administrator to check that there is no data from other applications in the
           selected raw device!).
           You can decide which of the displayed raw devivces you would like to select. SAPDBA
           informs you if the naming convention does not correspond to the SAP norm.If
           necessary, change the raw device ID as user root.
       • File size on raw device: You can reduce the size after selecting a raw device, but the
           space which remains will not be used.
        Display current files: SAPDBA displays the data files of the tablespaces and their sizes.
        Depending on the operating system, the database may be limited to a certain number of
        data files (usually at least 254 files with maximum 2GB per file). If an extension moves
        you closer to this limit, you should reorganize the tablespaces that contain a large
        number of data files. This will occur only rarely, however, since the number of available
        data files (254) is almost always large enough. Therefore, do not reorganize tablespaces
        of the database until you actually reach this limit.
        See Limitations of the Database System [Page 579].
3. Select Start (Add datafile) to accept the file specification.
4. At this point, SAPDBA checks the block sizes. The following values are displayed:
Extending a Tablespace
       filesystem block              size: <size>
       filesystem fragment           size: <size>
       Oracle block                  size: <size>
       If the sizes do not agree, an appropriate warning message appears and SAPDBA will
       ask whether you want to continue.
       Successful tablespace extension: When SAPDBA has created the new data file, it
       automatically branches to the Backup database menu, to enable you to back up the
       extended tablespace.
       See Backup Recommended [Page 680].
       Failed tablespace extension: If the data file could not be added, SAPDBA deletes the
       corresponding directory or symbolic link and cancels the tablespace extension. Your
       system and database are unchanged.
       See SAPDBA Troubleshooting [Page 693].
       Use the ORACLE ALERT and trace files to analyze and correct the problem, then repeat
       the tablespace extension procedure.
5. SAPDBA generates a log: <timestamp>.ext. This log can be used to verify that the
   tablespace extension was successful.
Specifying the File Size [Page 689]
Naming Convention [Page 691]
New Path [Page 692]
SAPDBA Troubleshooting [Page 693]

Specifying the File Size
SAP has default percentages for the growth in tablespaces in the SAPDBA profile
init<DBSID>.dba (See tspadd_tspname [Page 287]). While these percentages are based on
past experience, growth in tablespaces can vary widely, and you may want to change the default
settings for your system. You can therefore enter a different file size than the default in the
SAPDBA profile to reflect the actual growth you expect in the tablespace.
Guideline
You should size a new data file for that file to accommodate the growth of the tablespace for a
long period. For a critical, rapidly growing tablespace, the file should be as large as possible.
You also need to take the available storage space and the storage requirements of other
tablespaces into account.
If you add many small files to a tablespace, you may need to reorganize the tablespace. This
can be extremely time­consuming. Please also consider that you will have to shut down the R/3
System in order to reorganize the database. Reorganizing tablespaces with data files is the most
complicated type of reorganization and should therefore be done as infrequently as possible. To
avoid such situations, you should always add a sufficiently large file when extending a
tablespace.
To minimize storage problems and in order not to reach the maximum number of files for the
database system too quickly, SAP recommends that you do not set file sizes to values lower than
those recommended below.
The following table contains tablespaces which should be monitored during productive operation:
Minimum File Sizes for Critical Tablespaces: Production
     Tablespace        Minimum extension size (in MB)           Minimum extension size (in MB)
                       for data tablespace (D)                  for index tablespace (I)
      PSAPCLU           300                                      50
      PSAPBTAB          300                                      200
      PSAPSTAB          100                                      50
      PSAPPOOL          100                                      50
      PSAPPROT          100                                      50
Before transferring transaction data or starting production use of the system, each of these
tablespaces must be extended with at least one file that is larger than the proposed minimum
extension size.
If you work with client computers based on different hardware platforms, then you should also
monitor PSAPLOADD/I or PSAPEL300D/I carefully.
             Changes in these default values are entirely possible, especially ­ for example ­
             when the EarlyWatch Service has determined other values to be more effective for
             your system.

Specifying the File Size
During an SAP update or upgrade, in addition to the tablespaces listed above, you should check
and ­ when necessary ­ extend the tablespaces listed below.
Minimum Extension Sizes for Critical Tablespaces: Update/Upgrade
     Tablespace            Minimum extension size (in MB)       Minimum extension size (in MB)
                           for data tablespace (D)              for index tablespace (I)
      PSAPDOCU              100                                  50
      PSAPDDIC              50                                   20
      PSAPSOURCE            50                                   20
      or PSAPES300
If possible, store I/O­intensive tablespaces each on separate hard disks.
If possible, select different mount points for a data tablespace and its index tablespace when you
set up the database.
              The SYSTEM tablespace can also be extended by SAPDBA. However, the size of
              the SYSTEM tablespace cannot be reduced after you have extended it.
              A tablespace extension to PSAPTEMP can be cancelled by SAPDBA with the
              corresponding reorganization means. However, this is only possible if there are no
              temporary segments in PSAPTEMP (that is, you have to log off all the other users).
              You can undo a tablespace extension to PSAPROLL only by means of irregular
              procedures using ORACLE functions. Excellent knowledge of ORACLE procedures
              is required!

Naming Convention
File Systems
As a default, SAPDBA attempts to add a new file to the standard SAP directory in which the most
recent data file of the tablespace was stored. The most recent file is the one with the highest file
number.
    •   Directory: <ORACLE_HOME>/sapdata<n>/<tablespace name>_<file number>
    •   File name: <tablespace name>.data<file number>
Also see Environment Variables [Page 45].
<n> is the sequentially assigned number of the SAP directory in which the data file will be stored.
<file number> is the sequentially assigned number of the data file in the tablespace. The
same number also appears in the subdirectory which is created for each new file in a tablespace.
             You are adding a third data file to tablespace PSAPDOCUD in the R/3 System
             database C11. PSAPDOCUD consists of the following files:
             /oracle/C11/sapdata1/docud_1/docud.data1
             /oracle/C11/sapdata2/docud_2/docud.data2
             SAPDBA suggests /oracle/C11/sapdata2 for the new data file, and creates a
             subdirectory docud_3, in which the file is created with name docud.data3.
             Thus, the complete new file name is:
             /oracle/C11/sapdata2/docud_3/docud.data3.
Raw Devices
See SAPDBA Support for Raw Device Configuration [Page 767].

New Path
You can enter a different directory path for the new data file if the standard directory does not
have enough storage space for the file. You can create the file in a file system that has sufficient
space.
To operate your database in a safer, more efficient manner, SAP recommends specifying a new
path in certain cases. These files can be on the same hard disk as the redo log files if the redo
log files are mirrored. However, SAP recommends for performance reasons that data files and
redo log files always be stored on different hard disks.
See Organizing Disk Storage [Page 38].
SAPDBA does not allow you to change the name of the data file. You can, however, change the
directory path as follows:
     •    Other sapdata directory: You can create the file in a different standard directory,
          sapdata<n>. The directory must already exist and should be stored in a file system
          others than the one suggested by SAPDBA. Use Select path to select the directory.
          SAPDBA creates the new data file in the directory that you entered. It does not create a
          symbolic link from the directory it recommended.
          Please note that specifying a different directory may result in competing I/O accesses,
          which can diminish the performance of your system.
     •    Non­standard path: You can create the file under a path which does not correspond to
          the SAP standard.
          Example: You have set up and mounted a disk for data files. New files must therefore be
          added under path /usr/newdisk and not under the standard path.
          SAPDBA performs the following tasks:
          –   It creates a subdirectory <tablespace name>_<file number> in the new
              directory /usr/newdisk, which you specified.
          –   It creates a symbolic link between the SAPDBA default directory (e.g.
              /oracle/C11/sapdata2/<tablespace name>_<file number>) and the new
              subdirectory /usr/newdisk.
          –   It creates a file <tablespace name>.data<file number> in the new
              subdirectory.
          The symbolic link is transparent in the Data Dictionary of the database. The Data
          Dictionary recognizes only that the file exists in the standard SAP directory.
     See Naming Convention [Page 691].
     •    Raw device: SAPDBA behaves as described in the section Non­standard path. The
          symbolic link is set from <ORACLE_HOME>/sapraw to the corresponding raw device.
          The file <tablespace­name>.data<file number> does not have to be created.
          See also SAPDBA Support for Raw Device Configuration [Page 767].

SAPDBA Troubleshooting
Before an additional file is added, SAPDBA carries out the following checks (if file systems are
used):
     •   Block size: The following block sizes must be identical:
                                               Block size for
                                                the file system
         filesystem block size
                                                the file system fragments
         filesystem fragment size
                                                the database system
         ORACLE block size
         SAPDBA verifies that the above values are identical. If not, it issues a warning message
         and suggests selecting a new file system. You can ignore the warning and continue, but
         this is not recommended, as system performance will be affected when the block sizes of
         the file system and database are different.
         Please also note the following:
         –    The ORACLE database block size is always 8 KB in the R/3 System.
         –    SAPDBA does not perform the check under the AIX operating system, as the block
              sizes are always different:
                                              4 KB
              ORACLE block size
                                              8 KB
              filesystem block size
         –    For OSF1, the value for filesystem fragment size is always 1 KB, and is
              therefore not checked by SAPDBA.
     •   Disk storage space: SAPDBA checks that there is sufficient storage in the file system
         proposed for the new file. If not, SAPDBA does not add the file.
If these checks were successful, SAPDBA creates a directory or a symbolic link for the data file.
The control file (old and new) is backed up under the directory (directory name: <timestamp>)
belonging to the log file (<timestamp>.ext). SAPDBA then creates the data file with ALTER
TABLESPACE ADD DATAFILE. If any of these operations fails, SAPDBA is terminated
immediately.

Creating a Tablespace
The function Create tablespace is used to create new tablespaces. SAPDBA only supports the
creation of tablespaces that correspond to the naming conventions for SAP tablespaces
(PSAP<name>D/I). PSAPROLL and PSAPTEMP can also be created with SAPDBA, but not
tablespace SYSTEM.
When you create a tablespace, SAPDBA verifies that the corresponding data and index
tablespaces already exist. The results of the check are displayed, but any missing tablespaces
are not created automatically. You must ensure that both the data tablespace and the index
tablespace exist.
Enter the name of the tablespace. Then select Create tablespace <tablespace name>. The
following menu options appear, depending on whether you want to assign a file (in file system) or
a raw device (on raw device) to the tablespace.
Create new tablespace <tablespace name>
Corresponding <index/data> tablespace <tablespace name> exists/does not exist
              File system                   Raw Devices
        a ­ File system or raw device       File system or raw device
                                            New data file name/Required raw device name
        b  ­   File size                    Enter raw device name
        c  ­  Select sapdata path           Select raw device in path
        d  ­  Alter suggested path          File size on raw device
        e  ­  Default storage parameters
        s  ­  Start (create tablespace)     Start (create tablespace)
        q  ­  Return                        Return
File system or raw device: SAPDBA displays whether you are working in a file system (file
system) or on raw devices (raw device). You can choose again here between working in the file
system or on raw devices. If you are working on raw devices, the ORACLE name of the raw
device and the required raw device ID are displayed. See also Raw Devices and SAPDBA [Page
767].
File system:
     •  File size: Enter the desired size of the data file of the tablespace. If you do not specify a
        value, the double block size (generally 16 KB) will be selected. Do not use the default,
        but instead enter a file size appropriate for your requirements.
     •  Select sapdata path: SAPDBA displays a list of all sapdata directories and highlights
        the directories that are already used by the tablespace and its corresponding D/I
        tablespace (used (<n> x), where <n> is the number of files).
        You can decide which of the displayed sapdata directories you want to create the new
        tablespace in. Make sure that a data tablespace and its corresponding index tablespace
        lie in different sapdata directories.
        Always use Select path to define the name of the new data file, as this will provide you
        with additional important information: which directories are available, how much free

        storage space is available, which directories contain the files of the corresponding
        tablespaces (if they exist).
    •   Alter suggested path: SAPDBA suggests a path according to the SAP naming
        conventions for data files (the suggestion is a path which does not contain a file of the
        corresponding tablespace) or displays the one you selected with Select path. Only the
        first part of the complete target directory is suggested (<ORACLE_HOME>/sapdata<n>).
        The other part of the directory and the file name itself are defined according to the SAP
        naming conventions.
        See Naming Convention [Page 691].
        You can also specify a different file name. In this case, SAPDBA also checks whether
        there is sufficient storage space in the file system which was suggested to store the new
        data file.
    •   Default storage parameters: The storage parameters for the tablespace are displayed
        here: INITIAL 16 KB, NEXT 40 KB, MINEXTENTS 1, MAXEXTENTS 300,
        PCTINCREASE 0. You can change these values. If a table or an index is created in this
        new tablespace later on without explicitly specifying the storage paramters, the values
        set for this object with Alter default storage are assumed.
Raw Devices:
    •   Enter raw device name: Define the name of the required raw device. You can enter the
        complete path here; if you do not do so, the path definition under select raw device will
        be automatically used.
        SAPDBA checks whether:
–             ­ the raw device exists
–             ­ ora<sapsid> is the owner
–             ­ an ORACLE file of <DB­name> resides there
–             ­ a file system (mounted) resides there.
        SAPDBA does not check whether the raw device is used by another application or
        whether the disk is partitioned and the partitions are reserved.
    •   Select raw device in path: SAPDBA displays a list of the raw devices which can be
        used to create the tablespace (owner: ora<sapsid>. Caution: It is the responsibility of
        the database administrator to check that no data from other applications is residing on
        this raw device.)
        You can decide which of the displayed raw devices you would like to select. SAPDBA
        informs you if the naming convention does not correspond to the SAP norm. If
        necessary, change the raw device ID as user root. SAPDBA displays the size of the
        selected raw device, but it cannot be changed.
    •   File size on raw device: You can change the size of a raw device that you have
        selected. However, you can no longer use the remaining space.
Start (create tablespace): Creates the tablespace. SAPDBA generates a log
<timestamp>.ext.
SAP lets you create more of your own tablespaces (PSAPUSER<n>D/I, n<=9) in addition to the
delivered tablespaces (see Tablespaces and SAP Naming Conventions [Page 41]). SAPDBA

Creating a Tablespace
updates the database tables TAORA and IAORA to enable you to create tables and indexes for
the new tablespaces you defined from within the R/3 System.

Vous aimerez peut-être aussi