Skip to main content

Posts

Showing posts from September, 2013

How to make database offline or online

1)With the help of Alter database Command We can make the database offline or online with the help of the Alter database command. The Alter Database command to make the database offline is: ALTER DATABASE database name SET Offline If we want to make the database online we can use the following Alter Database command: ALTER DATABASE database name SET Online 2)With the help of the Db_options We can also use the db_options command to make a database offline or online.To make a database offline we can use the following command: sp_dboption databasename , ' offline' , true To make the database online we can use the following command: sp_dboption databasename , ' offline' , false 3)With the help of Sql server management studio We can also use the Sql server management studio to make a database offline as shown in the given figure. To make database offline we have to follow steps show in fig 1 and to bring back the database online we needs to

ORA-06550, WMSYS.LT_EXPORT_PKG.schema_info_exp

When you do full database export it fails will following errors as below. Export: Release 11.2.0.1.0 - Production on Mon Sep 30 12:04:38 2013 Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved. ;;; Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SYS"."SYS_EXPORT_SCHEMA_01":  /******** AS SYSDBA schemas=user1 directory=data_pump_dir dumpfile=user1.dmp logfile=user1.log Estimate in progress using BLOCKS method... Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 0 KB Processing object type SCHEMA_EXPORT/USER Processing object type SCHEMA_EXPORT/SYSTEM_GRANT Processing object type SCHEMA_EXPORT/ROLE_GRANT Processing object type SCHEMA_EXPORT/DEFAULT_ROLE ORA-39127: unexpected error from call to export_string :=WMSYS.LT_EXPORT_PKG.schema_info_exp('user1&

How to access two Database in one server

If you have two databases on the same server, how to  connect in SQL*Plus? ---------- C:\>set ORACLE_SID=orcl C:\>echo %oracle_sid% orcl C:\>SQLPLUS /NOLOG SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 30 12:26:08 2013 Copyright (c) 1982, 2010, Oracle.  All rights reserved. SQL> conn / as sysdba Connected. SQL> show user; USER is "SYS" SQL> SQL> select * from global_name; GLOBAL_NAME -------------------------------------------------------------------------------- ORCL SQL> C:\>set ORACLE_SID=orcl1 C:\>echo %oracle_sid% orcl1 C:\>SQLPLUS /NOLOG SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 30 12:26:08 2013 Copyright (c) 1982, 2010, Oracle.  All rights reserved. SQL> conn / as sysdba Connected. SQL> show user; USER is "SYS" SQL> SQL> select * from global_name; GLOBAL_NAME -------------------------------------------------------------------------------- ORCL1 SQL

Connecting DB with different users

When you connect using sysdba or sysoper, then you are sys or public user, no matter what username/password you provide : $ sqlplus / as sysdba SQL*Plus: Release 10.1.0.3.0 - Production on Mon Jan 2 18:00:59 2006 Copyright (c) 1982, 2004, Oracle.  All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production With the Partitioning, OLAP and Data Mining options SQL> sho user USER is "SYS" SQL> conn / as sysoper Connected. SQL> sho user USER is "PUBLIC" SQL> conn scott/tiger as sysdba Connected. SQL> sho user USER is "SYS" SQL> conn test/test as sysoper Connected. SQL> sho user USER is "PUBLIC"

Querying dba_objects

SQL> desc dba_objects;  Name                                      Null?    Type  ----------------------------------------- -------- ----------------------------  OWNER                                              VARCHAR2(30)  OBJECT_NAME                                        VARCHAR2(128)  SUBOBJECT_NAME                                     VARCHAR2(30)  OBJECT_ID                                          NUMBER  DATA_OBJECT_ID                                     NUMBER  OBJECT_TYPE                                        VARCHAR2(19)  CREATED                                            DATE  LAST_DDL_TIME                                      DATE  TIMESTAMP                                          VARCHAR2(19)  STATUS                                             VARCHAR2(7)  TEMPORARY                                          VARCHAR2(1)  GENERATED                                          VARCHAR2(1)  SECONDARY                                          VARCHAR2(1)  NAM

shared_pool_size and stream_pool_size

SQL> show parameter sga_max_size ; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ sga_max_size big integer 1G SQL> show parameter sga_target; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ sga_target big integer 900M SQL> show parameter pool; NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ buffer_pool_keep string buffer_pool_recycle string global_context_pool_size string java_pool_size big integer 0 large_pool_size big integer 0 olap_page_pool_size big integer 0 shared_pool_reserved_size big integer 30M shared_pool_size big integer 600M streams_pool_size big integer 252M If you  want to increase streams_pool_size by this command. alter system set STREAMS_POOL_SIZE =16M sid = 'orcl';

Find users with DBA privilege

If you wish to know which users have been granted the dba role then you need to query the dba_role_privs in the SYS schema. This role tells you the grantee, granted_role, whether they have admin option granted, and whether the role is their default role: SQL> desc dba_role_privs Name         Null?    Type ------------ -------- ------------ GRANTEE               VARCHAR2(30) GRANTED_ROLE NOT NULL VARCHAR2(30) ADMIN_OPTION          VARCHAR2(3) DEFAULT_ROLE          VARCHAR2(3) To find a list of all users with DBA privilege execute the following code: SQL> select * from dba_role_privs where granted_role='DBA'; GRANTEE   GRANTED_ROLE ADM DEF --------- ------------ --- --- SYS       DBA          YES YES SYSTEM    DBA          YES YES

ORACLE INSTALATION in LINUX MACHINE

Oracle Installation Prerequisites Perform either the Automatic Setup or the Manual Setup to complete the basic prerequisites. The Additional Setup is required for all installations. Automatic Setup If you plan to use the "oracle-validated" package to perform all your prerequisite setup, follow the instructions at  http://public-yum.oracle.com  to setup the yum repository for OL, then perform the following command. # yum install oracle-validated All necessary prerequisites will be performed automatically. It is probably worth doing a full update as well, but this is not strictly speaking necessary. # yum update Manual Setup If you have not used the "oracle-validated" package to perform all prerequisites, you will need to manually perform the following setup tasks. In addition to the basic OS installation, the following packages must be installed whilst logged in as the root user. This includes the 64-bit and 32-bit versions of some packages.

Oracle shutdown commands

Oracle Normal Shutdown A normal shutdown of an Oracle database is actually rarely used. This is because the normal shutdown waits for everyone to complete their work and then logoff in an orderly fashion. When a normal shutdown occurs, the database is closed in a normal manner, and all changes made in the database are flushed to the database datafiles.  This is known as a “clean shutdown”. Most of the time this is not practical… there always seems to be someone who has left for vacation and who forgot to log out, or there are times that Oracle processes become “zombied” (this is where Oracle thinks someone is connected to the database but they really are not). In these cases, the database will never come down. It will simply wait forever until you manually kill those sessions. Because of this, we often recommend the shutdown immediate or shutdown abort commands, SQL> shutdown When you execute a shutdown, Oracle will flush all the changes in memory out to the databas