Wednesday 26 September 2007

Clone db using RMAN & Point in time

I have performed another successful test with this on 26 Sept 2007 (this time clone point in time), worked like a dream on a staging env. See word document for more detail.

Good links:
http://users.telenet.be/oraguy.be/make_a_clone_of_your_database_1.htm
http://www.oracle-base.com/articles/9i/DuplicateDatabaseUsingRMAN9i.php



##############
# niDB's note on Restore as Clone db.
#
# Basic steps, please see docs for more detail. Run the steps with care.
# DO prepare a test on your staging evn before running these command on Prod
#
# Tested success on 9i and 10g (Linux)
#
# [Source db]=NIDEV1, [Clone db]=NITST1,
##############


# Make sure all the backup files are available on the source db box.
# If offline or on tape copy them back and make sure Oracle user can read them.
##############


# On clone box, create password file
##############
cd $ORACLE_HOME/dbs
orapwd file=orapwNITST1 password=oracle entries=5


# In the source database box, add following to your TNSNAMES file.
##############
NITST1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = dbtst1.nidb)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = NITST1)
)
)



# In the clone database box, add following to your LISTENER file & reload.
##############
(SID_DESC =
(GLOBAL_DBNAME = NITST1)
(ORACLE_HOME = /opt/oracle/product/9.2.0)
(SID_NAME = NITST1)
)

$ lsnrctl reload



# Based on the source db, create pfile for Clone database (copy original database
# pfile and modify below).
##############
*.background_dump_dest='/u01/oracle/admin/NITST1/bdump'
*.core_dump_dest='/u01/oracle/admin/NITST1/cdump'
*.user_dump_dest='/u01/oracle/admin/NITST1/udump'

*.db_name='NITST1'
*.instance_name='NITST1'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=NITST1XDB)'

# Added following to pfile so we use pfile to change location:
*.DB_FILE_NAME_CONVERT=(/u01/oracle/oradata/NIDEV1, /u01/oracle/oradata/NITST1)
*.LOG_FILE_NAME_CONVERT=(/u01/oracle/oradata/NIDEV1, /u01/oracle/oradata/NITST1)


# Copy the RMAN backup files from source database to clone server.
# Kept the location of backup files identical to original database server.
# Start the clone database on nomount, make sure you exit:
##############
sqlplus /nolog
startup nomount
exit


# To duplicate to clone database, on Souce connect to Source, rman catalog & clone
# database
# Use following command to connect
##############
export ORACLE_SID=NIDEV1
export NLS_LANG=.UTF8
export NLS_DATE_FORMAT='Mon DD YYYY HH24:MI:SS'

$ rman target / catalog rman/rman@[SOURCE_RMAN] auxiliary sys/oracle@NITST1

RMAN> run {
set newname for datafile 1 to '/u02/oracle/oradata/NITST1/system01.dbf';
set newname for datafile 2 to '/u02/oracle/oradata/NITST1/undotbs01.dbf';
set newname for datafile 3 to '/u02/oracle/oradata/NITST1/sysaux01.dbf';
set newname for datafile 4 to '/u02/oracle/oradata/NITST1/users01.dbf';
set newname for datafile 5 to '/u02/oracle/oradata/NITST1/NITST1_APP_01.dbf';
set newname for datafile 6 to '/u01/oracle/oradata/NITST1/NITST1_INDEX_01.dbf';
set newname for datafile 7 to '/u01/oracle/oradata/NITST1/NITST1_LARGE_DATA_01.dbf';
set newname for datafile 8 to '/u01/oracle/oradata/NITST1/NITST1_tools_01.dbf';
set newname for tempfile 1 to '/u02/oracle/oradata/NITST1/temp01.dbf';
DUPLICATE TARGET DATABASE TO NITST1 UNTIL TIME 'Sep 14 2005 14:17:00'
LOGFILE
GROUP 1 ('/u01/oracle/oradata/NITST1/redo01.log') SIZE 50M,
GROUP 2 ('/u02/oracle/oradata/NITST1/redo02.log') SIZE 50M,
GROUP 3 ('/u03/oracle/oradata/NITST1/redo03.log') SIZE 50M;
}


# Shudown clone and startup clone with resetlogs options.
##############
startup mount;
alter database open resetlogs;

Tuesday 25 September 2007

Lob package and error

User getting following error on the new 10g

ORA-22835: Buffer too small for CLOB to CHAR or BLOB to RAW conversion (actual:
6254, maximum: 4000)


This works on 9i but givs error on 10g
select
TO_CHAR(detail_info_clob)
from nidb_tab where DBMS_LOB.GETLENGTH(detail_info_clob) = 6254 and rownum <>


Fix: Above works on 9i but result is cut off afte 4K data, for all 4K+ clob shuld be using DBMS_LOB pkg.

select
DBMS_LOB.GETLENGTH(detail_info_clob)
from nidb_ta;

select
DBMS_LOB.SUBSTR(detail_info_clob, 3998, 1)
from nidb_tab where DBMS_LOB.GETLENGTH(detail_info_clob) = 6254 and rownum <>

select
DBMS_LOB.SUBSTR(detail_info_clob, 3998, 3995)
from nidb_tab where DBMS_LOB.GETLENGTH(detail_info_clob) = 6254 and rownum <>

Thursday 20 September 2007

rda

Could you run a rda report and upload to metalink ?
Reference Note.314422.1 Remote Diagnostic Agent (RDA) 4 - Overview and User Guide

PERFSTAT (stats) tablespace cleanup

Freeing space on PERF_STAT tablespace, first purge and then move tablespaces for large objects. (tested on 9i and 10g)


@?/rdbms/admin/sppurge

==

conn system

grant resource to perfstat;

conn perfstat/perfstat

alter table STATS$SQL_SUMMARY move tablespace active_v2;
alter table STATS$SQL_SUMMARY move tablespace perf_stat;
alter table STATS$SQLTEXT move tablespace active_v2;
alter table STATS$SQLTEXT move tablespace perf_stat;
alter table STATS$EVENT_HISTOGRAM move tablespace active_v2;
alter table STATS$EVENT_HISTOGRAM move tablespace perf_stat;
alter table STATS$LATCH move tablespace active_v2;
alter table STATS$LATCH move tablespace perf_stat;

select index_name, status from user_indexes where status not like 'VALID';

alter index STATS$LATCH_PK rebuild;
alter index STATS$SQL_SUMMARY_PK rebuild;
alter index STATS$SQLTEXT_PK rebuild;
alter index STATS$EVENT_HISTOGRAM_PK rebuild;

select index_name, status from user_indexes where status not like 'VALID';

conn system
revoke resource from perfstat;

Thursday 13 September 2007

Apache and PHP

Apache2 and PHP4

1. Unzip php and copy to C:\Php (better to keep it in that location and same name to avoid issues)

2. Copy C:\Php\Php4ts.dll to your Windows system folder 'C:\WINDOWS'

3. Rename and Copy C:\Php\php.ini-dist to your Windows system folder 'C:\WINDOWS\php.ini'

4. Modify httpd.conf and add below (you can also add extra e.g. docroot change etc)
#NI: PHP version 4, add in around line 175
LoadModule php4_module "C:/php/sapi/php4apache2.dll"

#NI: AddType, add in around line 775
AddType application/x-httpd-php .php
AddType application/x-httpd-php-source .phps


#NI: Change default to UTF8, around 709
#AddDefaultCharset ISO-8859-1
AddDefaultCharset UTF-8


More help:
See net or below link
http://www.builderau.com.au/strategy/architecture/soa/Get-Apache-2-and-PHP-4-working-together-in-Windows/0,339028264,320273988,00.htm

Friday 7 September 2007

CV indexes Intermewdi

Error:
ORA-20000: Oracle Text error:
DRG-11207: user filter command exited with status 1
DRG-11222: Third-party filter does not support this known document format.
ORA-06512: at "CTXSYS.DRUE", line 160
ORA-06512: at "CTXSYS.CTX_DOC", line 1129
ORA-06512: at "AR_STATESTREET_CONSULT.CVPREVIEW", line 23



Fix was:
up2date compat-libstdc++-296

Doc ID: Note:301260.1

meta doc siad:
compat-libstdc++-7.3-2.96.128.i386.rpm