Skip to main content

Posts

Showing posts with the label DATABASE

ORACLE DATABASE CREATE SCRIPT

/* Script creates PVPROD02 database Actions include;    Create Database    Create Tablespaces    Setup Dictionary    Create Application Roles    Create Application Users */ ------------------------------------------------------------------------------------------ -- set SID ------------------------------------------------------------------------------------------ define CR_SID = PVPROD02 spool create_db_&CR_SID set time on set timing on set echo on set pagesize 4000 set linesize 2000 set trims on   connect / as sysdba startup  nomount ------------------------------------------------------------------------------------------ -- Create Database ------------------------------------------------------------------------------------------ CREATE DATABASE &CR_SID ARCHIVELOG     USER SYS IDENTIFIED BY sys4&CR_SID     USER SYSTEM IDENTIFIED BY system4&CR_SID     MAXLOGFILES 50     M...

DATAPUMP - EXPORT SCHEMA SCRIPT

#!/bin/ksh # # generic environment settings # . $HOME/.bash_profile   export ORAENV_ASK=NO . $ORACLE_HOME/bin/oraenv export ORACLE_SERVER=`uname -n` export ORACLE_SID=TEST export USER=dbadmin export PASSWD=white1112 export EXP_DIR=/backup/expdp/data/ export LOG_DIR=$EXP_DIR export EXP_SCHEMA=TEST export EXP_NAME=${ORACLE_SERVER}_${EXP_SCHEMA}_`date +%Y%m%d_%H%M` # # export schema and data # expdp $USER/$PASSWD SCHEMAS=$EXP_SCHEMA DIRECTORY=${ORACLE_SID}_expdp DUMPFILE=$EXP_NAME.dmp1,$EXP_NAME.dmp2,$EXP_NAME.dmp3, $EXP_NAME.dmp4 FILESIZE=8g PARALLEL=4 LOGFILE=$EXP_NAME.log #gzip -f ${EXP_DIR}/*.dmp? #find  $EXP_DIR -name "*.gz" -mtime +5 -type f -exec rm {} \; exit 0

DROP RESTORE POINT AND DELETING ALL THE ARCHIVE LOGS USING RMAN IN ORACLE

DROP RESTORE POINT AND DELETING ALL THE ARCHIVE LOGS USING RMAN IN ORACLE AND TURN OFF FLASHBACK AND ARCHIVE LOG MODE SQL> select name from v$database; NAME --------- PMITCKU SQL> column NAME format a40; SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#,               GUARANTEE_FLASHBACK_DATABASE, STORAGE_SIZE               FROM V$RESTORE_POINT               WHERE GUARANTEE_FLASHBACK_DATABASE='YES'   ORDER BY TIME;  2    3    4    5 NAME                                            SCN ---------------------------------------- ---------- TIME --------------------------------------------------------------------------- DATABASE_INCARNATION# GUA STORAGE_SIZE --------------------- --- ------------ FEB09_2011      ...

ABOUT SHMALL, SHMMAX AND SHMMNI KERNAL PARAMETER

SHMALL => MAXIMUM SHARED MEMORY ALLOCATED THAT THE SERVER CAN USE APART FROM THE PROCESSES UNIX TO RUN. SHMMAX => WHAT SHOULD BE THE MAXIMUM SIZE THAT EACH SHARED MEMORY CAN HAVE IN PHYSICAL RAM. SHMMNI => This parameter sets the system-wide maximum number of shared memory segments. using below we ca check and edit these parameters KERNAL PARAMETERS: LOCATION:  /PROC/SYS/KERNAL cd /prod/sys/kermal   :-) ls -ltr shm* -rw-r--r-- 1 root root 0 May 15 05:46 shmmax -rw-r--r-- 1 root root 0 May 15 09:23 shmmni -rw-r--r-- 1 root root 0 May 15 09:23 shmall sysctl -a | grep shm TO CHANGE KERNAL PARAMETERS: sysctl -w kernal.shmmax="xxxxxx" vi /etc/sysctl.conf  => edit and save the file. run sysctl -p command after editing the file. the changes will affect without restarting the server. SHMMAX and SHMALL are two key shared memory parameters that directly impact the way by which Oracle creates an SGA. While trying to create an SGA during a database startup, Oracle chooses...

ABOUT HUGE PAGES FOR ORACLE ADMINS

HUGE PAGES:   Overview of HugePages   ## HugePages is a feature integrated into the Linux kernel 2.6. Enabling HugePages makes it possible for the operating system to support memory pages greater than the default (usually 4 KB). ## Using very large page sizes can improve system performance by reducing the number of system resources required to access page table entries. ## Huge Pages is useful for both 32-bit and 64-bit configurations. ## Huge Page sizes vary from 2 MB to 256 MB, depending on the kernel version and the hardware architecture. ## For Oracle Databases, using Huge Pages reduces the operating system maintenance of page states, and increases Translation Lookaside Buffer (TLB) hit ratio.   the command to get Hugepagesize from os prompt 1) grep Hugepagesize /proc/meminfo Hugepagesize:       2048 kB 2) grep Huge /proc/meminfo AnonHugePages:         0 kB HugePages_Total:   14016 HugePages_Free:    ...

19C New features for oracle database admins

19C New features: 1) Ability to Create a Duplicate of an Oracle Database Using DBCA in Silent Mode You can now create a duplicate of an Oracle Database by using the createDuplicateDB command of Database Configuration Assistant (DBCA) in silent mode. 2) Ability to Relocate a PDB to Another CDB Using DBCA in Silent Mode You can now relocate a pluggable database (PDB) to another multitenant container database (CDB) by using the relocatePDB command of Database Configuration Assistant (DBCA) in silent mode. This feature enables automating the PDB life cycle operation of relocating a PDB using DBCA in silent mode. 3) Ability to Create a PDB by Cloning a Remote PDB Using DBCA in Silent Mode You can now create a pluggable database (PDB) by cloning a remote PDB using the createFromRemotePDB parameter of the createPluggableDatabase command of Database Configuration Assistant (DBCA) in silent mode. This feature enables automating the PDB life cycle operation of cloning a PDB using DBCA in silent ...

SOME 12C NEW FEATURES FOR ORACLE DATABASE ADMINS

12C NEW FEATURES: 1) Like sysdba, sysoper & sysasm, we have new privileges, in Oracle 12.1.0.     sysbackup for Backup operations     sysdg for Data Guard operations     syskm for Key management   2) Oracle Database 12c Data Pump will allow turning off redo for the import operation (only).    $ impdp ... transform=disable_archive_logging:y   3) CAN CREATE INVISIBLE COLUMNS AND WE CHANGE IT TO VISIBLE OR INVISIBLE   4) Moving and Renaming datafile is now ONLINE, no need to put datafile in offline.    SQL> alter database move datafile 'path' to 'new_path';   5). Restricting PGA size  - Pre Oracle 12c R1, there was no option to limit and control the PGA size. Although, you set a certain size to PGA_AGGREGATE_TARGET initialization parameter, in 12c we can restrict using PGA_AGGREGATE_LIMIT parameter.   6) ASM: Introduction of Flex ASM, ASM would run only on 3 instances on a cluster even if more than 3, th...

Where the statistics are stored in oracle database and views to check STATS details

Where the statistics are stored in oracle database and views to check STATS details? Statistics on tables, indexes, and columns are stored in the data dictionary. To view statistics in the data dictionary, query the appropriate data dictionary view (USER, ALL, or DBA). These DBA_* views include the following: DBA_TABLES DBA_OBJECT_TABLES DBA_TAB_STATISTICS DBA_TAB_COL_STATISTICS DBA_TAB_HISTOGRAMS DBA_INDEXES DBA_IND_STATISTICS DBA_CLUSTERS DBA_TAB_PARTITIONS DBA_TAB_SUBPARTITIONS DBA_IND_PARTITIONS DBA_IND_SUBPARTITIONS DBA_PART_COL_STATISTICS DBA_PART_HISTOGRAMS DBA_SUBPART_COL_STATISTICS DBA_SUBPART_HISTOGRAMS

Difference between AWR, ADDM and ASH reports

AWR: Automatic Workload Repository gathers, processes and maintains performance stats used for problem detection and self-tuning the databases. Different Components that uses AWR are: Automatic Database Diagnostic Monitor Undo Advisor SQL Tuning Advisor Segment Advisor Different types of AWR Reports for different purposes: For Single Instance Environment: @$ORACLE_HOME/rdbms/admin/awrrpt.sql For Oracle RAC Environment : @$ORACLE_HOME/rdbms/admin/awrgrpt.sql For a particular SQL Statement : @$ORACLE_HOME/rdbms/admin/awrsqrpt.sql For Comparing the reports : @$ORACLE_HOME/rdbms/admin/awrddrpt.sql ADDM: Automatic Database Diagnostic Monitoring Report analyzes the AWR data on a regular basis, to give you overview of the root cause of the problem which is affecting your database’s performance. It also provides suggestions or recommendations for rectifying any problem identified and lists the areas which are having no issues. ADDM recommends multiple solutions for the DBA to choose from which...

INTERVIEW QUESTIONS PART-2

·          Difference between awr,ash and addm report? ·          Main things required to configure RAC? ·          Difference Between public, private,vip and scanip? ·          What is active dataguard? ·          Table to find the gap in applying archivelog. ·          12c features? ·          Database tuning? ·          What are the things have to look in AWR? ·          How to derive the size of logical, physical n memory to create a database for oltp and datawarehouse environment and things to consider while creating it? ·          Where the statistics are stored in datab...