Amazon books

Friday, September 23, 2011

Resseting Oracle VM Manager Password for ADMIN or Any other user

1-Login to database as SYS user or OVS user

2-Take a backup from OVS_USER table
create table OVS_USER_BKP as select * from OVS_USER;

3-Run the command below:
UPDATE OVS_USER set password='testepasswd' where account_name='ADMIN';
commit;

4-Encrypt the password with this command below:
UPDATE OVS_USER set password=create_encrypt_passwd('testepasswd') where account_name='$USER';
commit;


Best Regards,
Paulo Portugal

Wednesday, September 21, 2011

Mount ISO on Linux

1-Create directory to be used
mkdir -p /mnt/disk

2-Mount using command below:
mount -o loop OracleVM-Manager-2.2.0.iso /mnt/disk


Best Regards,
Paulo Portugal

Creating OVS repository - Oracle VM

1-Create partition using fdisk

2-Make ocfs2
mkfs.ocfs2 /dev/sda4

3-Create repository
./opt/ovs-agent-2.3/utils/repos.py -n /dev/sda4 --options rw,sync

4-List ID for repository
./opt/ovs-agent-2.3/utils/repos.py -l

5-Mark it as a ROOT repos
./opt/ovs-agent-2.3/utils/repos.py -r 12d25384-1eda-4e95-9f91-1b6f304a5587


Best Regards,
Paulo Portugal

Thursday, August 25, 2011

adopmnctl.sh httpd: error while loading shared libraries: libdb.so.2: cannot open shared object file: No such file or directory

If you got message below:

"adopmnctl.sh httpd: error while loading shared libraries: libdb.so.2: cannot open shared object file: No such file or directory"

Apply patch 6078836 (that can be downloaded from Metalink).

Best Regards,
Paulo Portugal

Installing RPM packages for EBS R12

RPM packages elfutils-libelf-devel-0.125 and elfutils-libelf-devel-static-0.125 are pre-req for installing Oracle EBS R12.

When you first try to install it separately, it shows failed dependencies error.

To fix it you must install both packages together as follows:

##############################
rpm -Uvh elfutils-libelf-devel-0.137-3.el5.i386.rpm elfutils-libelf-devel-static-0.137-3.el5.i386.rpm
warning: elfutils-libelf-devel-0.137-3.el5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:elfutils-libelf-devel-s########################################### [ 50%]
2:elfutils-libelf-devel ########################################### [100%]
##############################

Best Regards,
Paulo Portugal

Thursday, June 2, 2011

How to change WEBLOGIC Console admin password for 11g (10.3)

1-First set environment variables
export BEAHOME=/u01/app/oracle/product/middleware
export DOMAIN_HOME=$BEAHOME/user_projects/domains/base_domain
export CLASSPATH=$CLASSPATH:$BEAHOME/wlserver_10.3/server/lib/weblogic.jar
cd $DOMAIN_HOME/bin
. ./setDomainEnv.sh

2- Now execute the command below to create the new password
cd ../security
mv DefaultAuthenticatorInit.ldift oldDefaultAuthenticator
java weblogic.security.utils.AdminAccount weblogic new_password . --DON'T FORGET THE "."


3- If it exists remove boot.properties file

cd ../servers/AdminServer
mv data data_old
cd security/
mv boot.properties oldboot.properties

4- Restart Weblogic server

cd $DOMAIN_HOME./startWebLogic.sh

Best Regards,
Paulo Portugal

Friday, May 6, 2011

Display number values in words

--Create emp table
create table emp
(emp_name varchar2(30),
sal number);

--Insert some data
insert into emp values ('Nome1',1300);
insert into emp values ('Nome2',1400);
insert into emp values ('Nome3',2300);
insert into emp values ('Nome4',5300);
insert into emp values ('Nome5',11300);
commit;

--Query and get number into words
col sal for 99999
col "Extenso" for a70
select sal, (to_char(to_date(sal,'j'), 'jsp')) "Extenso" from emp;

set linesize 140
col parameter for a30
select * from v$nls_valid_values where value like '%BRA%';
alter session set NLS_LANGUAGE='BRAZILIAN PORTUGUESE';
alter session set NLS_TERRITORY='BRAZIL';
export LANG=pt_BR

Regards,
Paulo Portugal

Exadata CellCLI command sintaxe:

--Create command:
–CREATE CELLDISK ALL
–CREATE GRIDDISK ALL PREFIX=‘’, SIZE=
--Drop command:
-DROP [CELLDISK | GRIDDISK] ALL

--Alter command:
-ALTER CELL [STARTUP | SHUTDOWN | RESTART ] SERVICES [ALL | MS | RS | CELLSRV]

--List command:
–LIST [ LUN | CELLDISK | GRIDDISK ] [] [DETAIL]


Regards,
Paulo Portugal

Tuesday, May 3, 2011

Exadata DCLI utility Examples

Below some dcli command examples:

--Check date of all your cells
$dcli -g mycells date

--List cell status
$dcli -c xxxxcell01,xxxxcell02,xxxxcell03,xxxxcell04 cellcli -e list cell

--Running a CellCLI script on many cells
$dcli -g mycells -x listphisicaldiskcommand.scl

--Running a script on all db servers logged in as oracle

$dcli -g mydbservers -l oracle -x dbwork.sh

Best Regards,
Paulo Portugal

Thursday, April 14, 2011

Creating IORM Plans on Oracle Exadata:

Create a simple plan:

CellCLI> alter iormplan
dbplan=((name=db1_prod, level=1, allocation=70),
(name=db2_prod, level=1, allocation=30),
(name=db1_dev, level=2, allocation=100),
(name=db1_test, level=3, allocation=70),
(name=other, level=3, allocation=40)),
catplan=''

CellCLI> alter iormplan active


Create a plan based on a Data Guard environment:

CellCLI> alter iormplan dbplan=( -
(name=mydbprod1, level=1, allocation=40, role=primary), -
(name=mydbprod2, level=1, allocation=30, role=primary), -
(name=mydbprod, level=2, allocation=20, role=standby), -
(name=mydbprod2, level=2, allocation=25, role=standby), -
(name=other, level=3, allocation = 50))


Best Regards,
Paulo Portugal

Wednesday, April 6, 2011

RMAN Delete archivelog backups

If you want to delete archivelog backups made before sysdate-2 execute the command below:

delete noprompt backup of archivelog all completed before 'sysdate-2';

Your archive backup script would be like that:

########################
run{
allocate channel t1 device type disk;

backup
format '/u01/backup/YOUR_DB_%t_%s_%U'
archivelog all
tag 'BKP_ARCH_YOURDB_2hs_2hs';

delete noprompt backup of archivelog all completed before 'sysdate-2';
}
########################

Best Regards,
Paulo Portugal

Thursday, March 24, 2011

How to change Java Heap Size - Weblogic

If you are trying to deploy and are facing timeout on Weblogic, try to increse Java Heap Size.

Find and edit file setDomainEnv.sh (path example: /ora01/XXX/WEBLOGIC/BEA/user_projects/domains/xxx_domain/bin):

Add lines below:

USER_MEM_ARGS="-Xms1024m -Xmx1024m -XX:PermSize=128m -XX:MaxPermSize=512m"
export USER_MEM_ARGS


Restart Weblogic:
stopWebLogic.sh
startWebLogic.sh

Test again!


Best Regards,
Paulo Portugal

Check whether Oracle Installation is 32bit or 64bit

Run the PL/SQL Block bellow to check which Oracle is installed:

################################################
set serveroutput on
declare
v_metadata varchar2(1000);
v_plataform varchar2(1000);
begin

select metadata into v_metadata from sys.kopm$;

select substr(lpad(v_metadata,112),109,4) into v_plataform from dual;

if v_plataform = 'B023' then
dbms_output.put_line(a => 'My Oracle installation is ----32bit----!');
else
dbms_output.put_line(a => 'My Oracle installation is ----64bit----!');
end if;

end;
/
################################################

Or just check oracle file in $ORACLE_HOME/bin:
--64 bit example
$ file oracle
oracle: setuid setgid ELF 64-bit LSB executable, AMD x86-64, version 1 (SYSV), for GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped

--32bit example:
$ file oracle
oracle: setuid setgid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.2.5, dynamically linked (uses shared libs), not stripped



Best Regards,
Paulo Portugal

Wednesday, March 2, 2011

Change hostname | IP address of an APEX Server

If you need to change IP address or | and hostname of server that hosts Oracle Application Express just run the command below after changing IP and hostname:

begin

dbms_xdb.setlistenerendpoint(
endpoint => dbms_xdb.XDB_ENDPOINT_HTTP
, host => '10.10.10.18'
, port => 8080
, protocol => dbms_xdb.XDB_PROTOCOL_TCP);
end;
/


After that, access your Apex site like http://10.10.10.18:8080/apex/apex_admin

Best Regards,
Paulo Portugal

Friday, February 4, 2011

ERROR: ccr.oracle.com installing Oracle Agent

If you are installing Oracle Grid Control agent in silent mode and got this error below:


Checking Temp space: must be greater than 150 MB. Actual 52640 MB Passed
Checking swap space: must be greater than 150 MB. Actual 5686 MB Passed
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2011-02-04_04-04-02PM. Please wait ...ERROR: ccr.oracle.com


Run the installation again adding the "-y" parameter like this:

./agentDownload.linux -b /u01/agent11g -y



Best Regards,
Paulo Portugal

Tuesday, February 1, 2011

Using Flash Cash on Tables with Exadata

When creating tables to use Exadata Flash Cash use the sintaxe below:

CREATE TABLE tab1 (col1 number)
PARTITION BY RANGE (col1)
(PARTITION p1 VALUES LESS THAN (1000)
STORAGE (CELL_FLASH_CACHE KEEP),
PARTITION p2 VALUES LESS THAN (2000)
STORAGE (CELL_FLASH_CACHE NONE),
PARTITION p3 VALUES LESS THAN (3000)
STORAGE (CELL_FLASH_CACHE DEFAULT));


You can also use ALTER TABLE or ALTER INDEX as follows:

ALTER INDEX idx1 STORAGE (CELL_FLASH_CACHE KEEP);


Best Regards,
Paulo Portugal

Table compression in 11gR2 Databases and Exadata

If you need to create a compress table for an OLTP system use the syntax below:

create table TAB_1(
col1 number,
col2 varchar2(30))
COMPRESS FOR OLTP;

If you need to create a compress table for Direct Load use the command below:

create table TAB_2 (
col1 number,
col2 varchar2(30))
COMPRESS BASIC;


Now you want to compress for Exadata Machine. For warehouse compression use:

CREATE TABLE tab_1 (
col1 number,
col2 varchar2(30))
COMPRESS FOR QUERY [ LOW | HIGH ] ;

For Online Archival Compression use:

CREATE TABLE tab_1 (
col1 number,
col2 varchar2(30))
COMPRESS FOR ARCHIVE [ LOW | HIGH ] ;


Best Regards,
Paulo Portugal

Exadata Smart Scan - CELL_OFFLOAD_PLAN_DISPLAY parameter

If you want to control whether the offload status is show in execution plan set the parameter as below:

ALTER SYSTEM OR SESSION SET CELL_OFFLOAD_PLAN_DISPLAY=ALWAYS;

The value options for this parameter are:
AUTO -> display the predicate if cell is present and table is on the cell
ALWAYS -> always show
NEVER -> never show offload status


Some views that can be used to gather cell statistics information:

V$SQLAREA
V$SQLSTATS
V$SQLAREA_PLAN_HASH
V$SQLSTATS_PLAN_HASH


on columns like :

IO_CELL_OFFLOAD_ELIGIBLE_BYTES
IO_CELL_OFFLOAD_RETURNED_BYTES



Best Regards,
Paulo Portugal

Sunday, January 30, 2011

Configuring a parallel backup in RMAN with RAC

In order to make the most use of your RAC environment you can parallel your backups simply by changing the following parameters:

RMAN> configure default device type to sbt;
RMAN> configure device type sbt parallelism 3;
RMAN> configure channel device type sbt connect='sys/passwd@MYDB';

Best Regards,
Paulo Portugal

Create an ASM instance in Silent mode using DBCA

Use the command below to create an ASM instance using dbca in Silent mode.

dbca -silent -nodelist node1,node2 -configureASM -asmSysPassword manager -diskString /dev/sd* -diskList /dev/sda2,/dev/sdb2 -diskGroupName DG_DATA -redundancy EXTERNAL

Best Regards,
Paulo Portugal

Thursday, January 27, 2011

How to find where is my OCR and Voting Disk devices

--For OCR get the value in ocr.loc file
[oracle@host1]/etc/oracle> cat /etc/oracle/ocr.loc
ocrconfig_loc=/dev/rlv_OCR1
ocrmirrorconfig_loc=/dev/rlv_OCR2
local_only=FALSE

OR use ocrcheck:

[oracle@host1]$ ocrcheck
Status of Oracle Cluster Registry is as follows :
Version : 2
Total space (kbytes) : 1048100
Used space (kbytes) : 3848
Available space (kbytes) : 1044252
ID : 865433463
Device/File Name : /dev/raw/raw4
Device/File integrity check succeeded

Device/File not configured

Cluster registry integrity check succeeded



--For voting use the command below:

[oracle@host1]/etc/oracle> crsctl query css votedisk
0. 0 /dev/rlv_VOTE1
1. 0 /dev/rlv_VOTE2
2. 0 /dev/rlv_VOTE3


Best Regards,
Paulo Portugal

Wednesday, January 26, 2011

How to Convert Single Instance to RAC Using rconfig - Summary

1-Edit ConvertToRAC.xml file that can be found at $ORACLE_HOME/assistants/rconfig/sampleXMLs directory.
2-Run the command below:
rconfig single_to_rac.xml

3-We can chose to only verify if the convertion will be OK using the option: Convert verify="ONLY".

4-To not check pre-req user Convert Verify="NO" otherwise use Convert verify="YES"

Best Regards,
Paulo Portugal

Tuesday, January 25, 2011

How to change ADMIN Oracle Apex Password

In order to change ADMIN password for your APEX run the command below:

SQL> conn / as sysdba
SQL> @apxxepwd.sql
Session altered.

...changing password for ADMIN
Enter value for 1: manager
Enter value for 1: manager

PL/SQL procedure successfully completed.


Commit complete.

Best Regards,
Paulo Portugal

Sunday, January 16, 2011

SSH with password in background NOHUP

Create a shell script to copy big files and run in background informing password inside scripts like that:

[hostname]$ cat cp_datafiles.sh
echo 'password_user_f2c' | scp f2c@10.1.0.7:/ocfs03/oradata/PEBS/data/* .


Best Regards,
Paulo Portugal

Friday, January 7, 2011

Reinstall SSH Linux - Error "Value too large for defined data type"

If getting error like below:

[appprdts@f2c04 Stage]$ ls -la
ls: bkp_appl_Prod110105_1909.cpio: Value too large for defined data type

--Remove SSH
yum remove openssh-server

--Install
yum install openssh-server

Best Regards,
Pauo Portugal