MaxDB - Administration

download MaxDB - Administration

of 20

Transcript of MaxDB - Administration

  • 7/30/2019 MaxDB - Administration

    1/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 1

    MaxDB Administration

    This section again will be fairly large, I will be discussing the following

    Installation

    Creating and Configuring a database

    Adding volumes

    Configuring log volumes and log mode

    Database backupsLog backups

    Database recovery

    Consistency checks

    Deleting the database

    Installation

    SAP MaxDB can be freely downloaded from the SAP website, there are a number of version to cover a wide range of operating systems. First I

    will discuss how to install MaxDB on a Unix server. Once downloaded you must extract the software either using winzip or SAPCAR, once

    extracted you should have the following files

    to start the installation as root run the SDBINST command and follow the below

    software components

    here you have a number of options

    0: Server + Client - select this option to install the entire MaxDB server software

    1: Client - installs all software exc ept server utilities, database kernel and APO LiveCache apps

    2: Custom - gives you an option on what components you want to install

    3: None - don't install anything

    Select option 2

    Custom installation

    here you have a number of options available

    0: Runtime for SAP AS - install NetWeaver AS on the server

    1: DBAnalyzer - only install the DBAnalyzer it also installs Base, M essages, SAP Utilties and DBAnalyzer

    2: JDBC - installs Base, SAP Utilities and JDBC

    3: Server - only installs the server components

    4: Loader - installs components for loading large data volumes via python

    5: ODBC - install components that are required for ODBC communications

    6: All - all components are installed

    7: None - cancel the installation

    Select option 3

    The installation will now ask a series of questions regarding below, you can change any of the above to suit you own requirement

  • 7/30/2019 MaxDB - Administration

    2/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 2

    Server Installation

    (preparing phase)

    group name e au : s a)

    owner name ( default: sdb)

    independent data path (default: /var/opt/sdb/data)

    independent program path (default: /opt/sdb/programs)

    The installation will go and do some stuff and come back requesting information regarding the database kernel preparing

    dependent path (default: /opt/sdb/7603)

    Server Installation

    (installation phase)The installation will now be carried out in the background, the database is automatically started

    Thats all there is to it, you can also use a commandline option to install MaxDB

    Installation in the

    background./SDBINST -component_group Server -indep_data /var/opt/sdb/data -indep_prog /opt/sdb/programs -o sdb -g sdba

    There is also a GUI version called the installation manager, this is mainly used on Windows installation.

    If there were any errors or problems installing the software you can view the installation logs

    Installation logs

    Unix:

    /wrk/M axDB_install--.log

    Windows:

    \wrk\M axDB_install--.log

    Creating and Initializing

    Before we can crete a new SAP MaxDB instance we need to know what requirements we need for the following

    What size should the database be

    How much load do you expect the database to have

    Now these type of questions are hard to judge when creating databases, if you really have no ideal then have one eye on how you would increase

    the the above if the thresholds were meet, for example you know that the data volumes are going to be spread across different disks then try to

    match the size of the filesystems with the volume sizes,also allow for additional disks to be added, with load try to have options that you can increase

    memory in your server at a later date.

    The size of the database is important as depending on the number of data volumes MaxDB configures the number of I/O threads, this is specified by

    the parameter_IOPROCS_PER_DEV. SAP recommends 2 for unix systems and 1 from windows systems. If you have two many threads per I/O

    may cause a performance bottleneck on the operating system. To calculate the number of data volumes SAP recommends the formula below

    Calculate data volumes

    You basically use the square root of the total volume size, now for some examples

    50GB = 7.07, so round up to 8 data volumes (50 / 8 = 6.25GB each)

    75GB = 8.66, so round up to 9 data volumes (75 / 9 = 8.34GB each)

    I generally round the size of each volume for eaxample the 6.25GB i would round upto 7GB.

    There are a number of restrictions that you must, be made aware of, keep an eye on the latest versions as I suspect these limits will increase withtime

    Maximum number of data volumes 4095

    Maximum number of log volumes Unrestricted

    Maximum size of data volume 512GB

    Maximum size of log volume 32TB

    Maximum size of entire instance 64TB

    Now lets move on to creating the database, I will be using the Database Manager GUI, although being a Unix chap, I will still use a GUI that is

    reliable and I have had no problems with this GUI, for the die hard CLI fans I have also given the commandline options.

  • 7/30/2019 MaxDB - Administration

    3/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 3

    Create a Database Instance

    Start the SAP Database Manager

    The MaxDB Database Manger GUI when open should look something like below

    Select the template type

    To create the instance you can either select instance -> create or select the c reate instance button (as seen in above

    picture), you will be asked to select one of the templates, have choose custom

    Desktop/PC - idea for a laptop development database

    Custom - use this to change default values, memory size, number of cpu's, etc

    My Template - you can even create your own custom template

    Database Instanc e Name

    Here we can give the Database Instance a name of our choosing, notice that you c an connect to an external MaxDB

    server and create Databases

  • 7/30/2019 MaxDB - Administration

    4/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 4

    Installation Version

    If you have multiple versions of MaxDB installed you can select any version you want

    Advanced Options

    There are a number of advanced options you can configure, I generally use them all

    Setup the DBM user

    Just put in the password of your choice

  • 7/30/2019 MaxDB - Administration

    5/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 5

    Parameter setup

    If you have a specific set of parameters that you wish to use then you have the option to use them here, i am just going

    for the defaults

    Instance Type

    Again I am going with the default, OLTP database. LiveCache by the way is a objected-oriented model that also uses the

    memory more

    Parameter Adjustment

    here I tweeked a number of parameters, memory, CPU's and MaxlogVolumes. You can change these settings at a later dat

    but the instance will require a reboot

  • 7/30/2019 MaxDB - Administration

    6/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 6

    Volume Setup

    By default a data volume and a log volume will be created adjust these to what you planned above,

    NOTE: One word of warning if you have selected to install the tutorial you must increase the size of the log volume

    otherwise the installation hangs, increase it to at least 1,024MB

    Creation Mode

    we need to create a password for the dbadmin account

    Advanced settings

    Some more advanced settings to adjust, if this is a development database i always like the tutorial data to play around

    with

  • 7/30/2019 MaxDB - Administration

    7/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 7

    Final Step - Summary page

    Finally we get to the summary page, check everything then select next to create the database instance

    Creating Database Page

    You will now see the creation of the database instance

    Finish page

    Finally you get the finish page confirming that the installation was successful.

  • 7/30/2019 MaxDB - Administration

    8/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 8

    Database Manager

    Once the installation has finished you should see the below in the database manager

    Of course you could just script it up which would like something like below

    Automated installation

    #Database Creation

    create_v5_db

    # User creation

    create_v5_users

    Configuring the Database

    Once you got the database up and running it time to enchance it, the first thing to do is to mirror the log volumes

    Start the database manager GUI, and select instance -> configuration -> log settings, you get the log configuration setting

    menu up

    Select log mode, then next, the menu will ask which log file to mirror

    http://www.datadisk.co.uk/html_docs/maxdb/create_v5_users.txthttp://www.datadisk.co.uk/html_docs/maxdb/create_v5_db.txt
  • 7/30/2019 MaxDB - Administration

    9/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 9

    Mirror Log Volumes

    Double click on the single log file and notice the bottom of the configuration screen, the mirror part should have been

    filled in with default values, you can change these if so desired

    When you named the mirror file you should see it back in the log settings screen

    You will be asked to confirm the creation of the mirror log file

    To confirm that the log is mirrored select instance -> configuration -> volumes -> select the log volumes button, you will

    notice that the "mirrored location" and "mirrored type" are filled in

    If automatic backup log mode has not already been configured now is the time to do this,

  • 7/30/2019 MaxDB - Administration

    10/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 10

    Automatic backup log

    First you need to create a log backup file select instance -> backup -> backup medium -> right click in the window and

    select new medium, fill in the details as you see fit

    Select instance -> backup -> backup wizard, Select the Activite/Deactivite automatic log backup

    Select the critrea that you need, normally i active a log backup when the log is full

    Select on to start the automatic backup log

    Once the database has been running a while you will be required to either add a data volume or a log volume, here are the steps to do this

    Select instance -> configuration -> volumes, select the next volume on the list and right click and select new volume

  • 7/30/2019 MaxDB - Administration

    11/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 11

    Adding a Data Volume

    Select OK to create the additional data volume

    the commandline option is as follows

    7.6:

    dbmcli> param_addvolume 1 DATA DATA_0002 F 50000

    dbmcli> param_getvolsall

    7.7:

    dbmcli> db_addvolume DATA DATA_0002 F 50000

    dbmcli> param_getvolsall

    Adding a Log Volume

    Select instance -> configuration -> volumes, click on the log volume button to display the log volumes, select the nextvolume on the list and right click and select new volume

    Note that because we have selected mirror log volumes (see above) the mirror will also be created

    the commandline option is as follows

    7.6:

    dbmcli> param_addvolume 1 LOG LOG_0002 F 6400

    dbmcli> param_getvolsall

    7.7:

    dbmcli> db_addvolume LOG LOG_0002 F 6400 PATITION 1

    dbmcli> param_getvolsall

    Deleting a Volume (Data or Log)deleting a volume is very simple, select -> instance -> configuration -> volumes, select the volume that you want to delete

    right click and select delete.

    Backups

    As with any system you need to take regular backups, MaxDB has a number of types of backups

    Complete and Incremental backup - standard type of backup that is used in most places

    Data and log backups - you generally backup the log volumes more than the database volumes (data - once a week, log - everyday)

    Parallel backup - used for very large databases, you can use multiple tape drives in parallel

    MaxDB has a very nice backup history which you can access via the database manager GUI

  • 7/30/2019 MaxDB - Administration

    12/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 12

    Backup History

    select instance -> backup -> backup history

    As you can see the backup history page has a lot of information, the action selection may contain the following

    Save Warm - a backup (data or log) was implemented

    Restore - a recovery of the database was performed

    Histlost - an event necessitates a new complete data backup

    I am only going to mention backup stategies in that you should have one, my personal one is to perform a full offline backup once a week and to

    backup the log files everyday, but I have small database of about 60GB.

    Before we can backup the database we need to create a backup medium (a backup device), these can be either

    File - standard backup file

    Tape - a tape device

    Pipe - a third party external backup tool (backint, TSM or NSR)

    create backup meduim

    using the database manager gui select instance -> backup -> backup medium, right click in the main window an select new

    medium

    fill in the details giving a name to the backup and stating the filename, etc

  • 7/30/2019 MaxDB - Administration

    13/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 13

    As you can see I have a number of backup mediums, including a log file meduim

    Once you have a backup medium you can backup your database

    Database Backup

    using the database manager GUI select instance -> backup -> backup wizard

    Select the backup medium

    Comfirm that you are happy then click on start, the backup will start

  • 7/30/2019 MaxDB - Administration

    14/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 14

    After a period the backup should be completed

    you can also use a commandline version

    dbmcli> medium_getall

    dbmcli> util_connect contro l,control

    dbmcli> backup_start Full_Backup RECOVERY DATA

    second session monitor the backup

    dbmcli> backup_state

    Log backups are perform using the same procedure, however you must deactive the automatic backup feature before performing a manual logbackup.

    Log backup

    First deactive the automatic log backup feature select instance -> backup -> backup wizard

    The select the log backup

  • 7/30/2019 MaxDB - Administration

    15/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 15

    Then just follow the steps as in the data backup

    you can also use a commandline version

    dbmcli> medium_getall

    dbmcli> util_connect contro l, control

    dbmcli> backup_start "LogBackup" LOG

    You can check your backups if you desire

    check backups

    to check your backups select instance -> check -> backup

    here you can select to chec k your last backup, a previous backup or select a backup medium, i have select to chec k th

    last backup

    MaxDb will now go and check the backups, a tick will be displayed against

  • 7/30/2019 MaxDB - Administration

    16/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 16

    Recovery

    Recovery is performed in the admin state, therev are two types of recovery

    Recovery

    Recovery with Initialization

    The difference between them is that with initialization data and log volumes are recreated, without initialization the volumes are left untouched

    the instance must be in the admin state, select instance -> recovery

    Here you have a number of choices, you can even spec ify a specific time. You then select the backup that you want to

    restore

    Once the data has been restored you then need to apply the log backups

  • 7/30/2019 MaxDB - Administration

    17/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 17

    recovery with initailization

    MaxDB will then display a summary screen indicating a successful restore or not

    you can of course use the commandline

    dbmcli> db_admin -f

    dbmcli> util_connect

    dbmcli> backup_history_list

    ## start the first recovery

    dbmcli> recover_start "CompleteBackup" data

    ## start a initialization recovery

    dbmcli> db_active recover "CompleteBackup" data

    ## import all the incremental backups, one after the other

    dbmcli> recover_start "IncrementalBackup" pages

    ## Import the first log backup

    dbmcli> recover_start "LogBackup" log 002

    ## Import any more log backups

    dbmcli> recover_replace "LogBackup" "MaxDB_LOG" 003

    dbmcli> db_online

    Snapshots

    From time to time you may wish to performa very large update, snapshots allows you rcover very quickly if the update was unsuccessful. You can

    save one snapshot per instance, thus old snapshots are overwritten.

    First the instance must be in the ADMIN state, then select instance -> backup -> create snapshot

  • 7/30/2019 MaxDB - Administration

    18/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 18

    Creating a snapshot

    select OK and the snapsjot will be created

    you can also use the commandline to c reate a snapshot

    dbmcli> db_admin

    dbmcli> db_execute create snapahot

    dbmcli> db_online

    Deleting a snapahot

    Again the database must be in an admin state, then select instance -> snapshot, select delete snapshot

    you can also use the commandline to delete a snapshot

    dbmcli> db_admin

    dbmcli> db_execute drop snapshot

    dbmcli> db_online

    Reverting to a snapshot

    Again the database must be in an admin state, then select instance -> snapshot, select revert to snapshot

    This may take sometime depending on the number of chanes to the database since the snapshot was taken

    you can also use the commandline to revert a snapshot

    dbmcli> db_admin

    dbmcli> db_execute restore snapshot

    dbmcli> db_online

  • 7/30/2019 MaxDB - Administration

    19/20

    5/9/13 MaxDB - Administration

    www.datadisk.co.uk/html_docs/maxdb/administration.htm 19

    viewing snapshot

    To see when the last snapshot was taken see the main database screen, look in the bottom right hand corner you will se

    a snapshot section

    Consistency Checks

    Internal data structures can become corrupted, a consistency check will allow to check the internal structure of the database. You can perform a

    consistency check either in online mode or admin mode.

    online mode - system checks which will correct saved schemas, relations and indexes

    admin mode - all of the above and also renews the converter

    Depending on the size of the database this may take a while to complete, so it is best to run it during quiet periods.

    select instance -> chec k -> database struc ture

    choose the one you want to run, you can speed things up alittle by not checking the indexes

  • 7/30/2019 MaxDB - Administration

    20/20

    5/9/13 MaxDB - Administration

    consistency check

    after a while you should get a summary page

    you can also use the commandline, here are some examples to check the consistency

    ## online checks

    dbmcli> db_execute check data

    dbmcli> db_execute chec k data except index

    ## offline checks

    dbmcli> db_execute check data with update

    ## online check but specified tables

    dbmcli> db_execute check table schema.table catalog

    dbmcli> db_execute check table schema.table with long check

    Previous Menu Next

    http://www.datadisk.co.uk/html_docs/maxdb/performance.htmhttp://www.datadisk.co.uk/html_docs/maxdb/maxdb.htmhttp://www.datadisk.co.uk/html_docs/maxdb/sap_maxdb.htm