When work load is low, we might reclaim space from temporary tablespace and files.
1. check database default temporary tablespace. If a temporary tablespace is default one, you can not drop it.
select property_name, value from database_properties where property_name = 'DEFAULT_TEMP_TABLESPACE';
2. Default temporary tablespace might be a temporary tablespace group. check if there is temporary tablespace group.if default temporary tablespace is a temporary tablespace group, any member tablespace of the group can not be drop
select * from dba_tablespace_groups;
3. create a new temporary tablespace with a small size file
select file_name from dba_temp_files;
create temporary tablespace newtemp tempfile '/u02/app/oradata/newtemp_01.dbf' size 10m autoextent on maxsize 100m
extent management local;
4. change default tablespace name
alter database default temporary tablespace newtemp;
5. if any user use a temporary tablespace as his/her default temporary tablespace, you can not drop the temporary tablespace
select distinct temporary_tablespace from dba_users;
select ' alter user ' || username || ' temporary tablespace newtemp ; ' from dba_users where temporary_tablespace = 'TEMP';
run generated sql statement
6. drop temporary tablespace with file
drop tablespace temp including contents and datafiles;
7. resize a tempfile
alter database tempfile '/u02/app/oradata/newtemp_01.dbf' resize 50m;
8. if you don't assign a user temporary tablespace explicitly, its temp tbs will be default one. when you change default temp on database level, its temp tbs will be reset to new default one.
9 assing a temp tbs to temp group
alter tablespace newtemp tablespace group TEMPGROUP;
10, remove a temp tbs from temp group;
alter tablespace newtemp tablespace group '';
11. check temp tbs usage
v$sort_segment
v$sort_usage
V$SORT_SEGMENT
V$TEMP_CACHE_TRANSFER
V$TEMP_EXTENT_MAP
V$TEMP_EXTENT_POOL
V$TEMP_SPACE_HEADER
V$TEMPFILE
V$TEMPORARY_LOBS
V$TEMPSEG_USAGE -- V$sort_usage
V$TEMPSTAT
EXAMPLE:
check temp usage:
SELECT A.tablespace_name tablespace, D.mb_total,
SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_used,
D.mb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_free
FROM v$sort_segment A,
(
SELECT B.name, C.block_size, SUM (C.bytes) / 1024 / 1024 mb_total
FROM v$tablespace B, v$tempfile C
WHERE B.ts#= C.ts#
GROUP BY B.name, C.block_size
) D
WHERE A.tablespace_name = D.name
GROUP by A.tablespace_name, D.mb_total;
Check session level temp usage:
SELECT S.sid || ',' || S.serial# sid_serial, S.username, T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace, s.sql_id
FROM v$sort_usage T, v$session S, dba_tablespaces TBS
WHERE T.session_addr = S.saddr
AND T.tablespace = TBS.tablespace_name
ORDER BY mb_used;
Reference:
http://www.dba-oracle.com/t_temporary_tablespace_groups.htm
http://www.idevelopment.info/data/Oracle/DBA_tips/Tablespaces/TBS_3.shtml
http://www.orafaq.com/forum/t/81733/0/
http://gavinsoorma.com/2009/06/temp-tablespace-usage/
Friday, May 25, 2012
sed command
1. from shell prompt
$> cat test.txt | sed 's/aaa/bb/g;s/cc/ddd/g' > newtest.txt
$> cat test.txt | sed '1,10s/aaa/bb/g;11,20s/cc/ddd/g' > newtest.txt
2. in VI
:%s/aa/bb/g #change the whole file
:s/aa/bb/g #change the current line
reference:
http://lowfatlinux.com/linux-sed.html
$> cat test.txt | sed 's/aaa/bb/g;s/cc/ddd/g' > newtest.txt
$> cat test.txt | sed '1,10s/aaa/bb/g;11,20s/cc/ddd/g' > newtest.txt
2. in VI
:%s/aa/bb/g #change the whole file
:s/aa/bb/g #change the current line
reference:
http://lowfatlinux.com/linux-sed.html
Change DB password for Informatica domain.
PROCEDURE
1. Shutdown Repository Service from admin console
2. Shutdown Integration Service from admin console
3. Shutdown informatica power center server
$INFA_HOME/tomcat/bin/infaservice.sh shutdown
4. change DB password
5. udpate domain with new password
$INFA_HOME/server/infasetup.sh UpdateGatewayNode -da [new database host]:[new database port] -du [new database user] -dp [new database password -dt [database type i.e. db2] -ds [new database name]
6. startup informatica server
$INFA_HOME/tomcat/bin/infaservice.sh startup
7. login into admin console
8. if repository service user the same db user as domain, change repository property with new password.
9 Start up Repository service
10. start up Integration service
Troubleshooting
a. if you don't shutdown repsoitory service before shutdown informatica server and repository and domain use one db user, admin console might not be available because the auto-startup of repository will auto-lock DB account in oracle database if profile is configured that way.
solution one: change password back to original one if you know. the startup informatica server and follow the procedure to change password.
solution two: create a copy of db user and update the domain with copy one. this should be ok, but we met some issue. need be tested again.
1. Shutdown Repository Service from admin console
2. Shutdown Integration Service from admin console
3. Shutdown informatica power center server
$INFA_HOME/tomcat/bin/infaservice.sh shutdown
4. change DB password
5. udpate domain with new password
$INFA_HOME/server/infasetup.sh UpdateGatewayNode -da [new database host]:[new database port] -du [new database user] -dp [new database password -dt [database type i.e. db2] -ds [new database name]
6. startup informatica server
$INFA_HOME/tomcat/bin/infaservice.sh startup
7. login into admin console
8. if repository service user the same db user as domain, change repository property with new password.
9 Start up Repository service
10. start up Integration service
Troubleshooting
a. if you don't shutdown repsoitory service before shutdown informatica server and repository and domain use one db user, admin console might not be available because the auto-startup of repository will auto-lock DB account in oracle database if profile is configured that way.
solution one: change password back to original one if you know. the startup informatica server and follow the procedure to change password.
solution two: create a copy of db user and update the domain with copy one. this should be ok, but we met some issue. need be tested again.
Wednesday, May 23, 2012
Cloud Control 12c Management
1. startup
$ORACLE_HOME/bin/emctl start oms
2. check status
$ORACLE_HOME/bin/emctl status oms
for details (need sysman password)
$ORACLE_HOME/bin/emctl status oms -details
3. shut down
$ORACLE_HOME/bin/emctl stop oms
4. start agent
$ORACLE_AGENT_HOME/agent_inst/bin/emctl start agent
5. check agent status
$ORACLE_AGENT_HOME/agent_inst/bin/emctl status agent
6. stop agent
$ORACLE_AGENT_HOME/agent_inst/bin/emctl stop agent
7. manage server logs
OMS Log File Log File Location
emctl log file:
$INSTANCE_HOME/sysman/log/emctl.log file
Managed Server log files:
$INSTANCE_HOME/user_projects/domains<DOMAIN_NAME>/servers/EMGC_OMS<n>/logs/EMGC_OMS<n>.log
$INSTANCE_HOME/user_projects/domains<DOMAIN_NAME>/servers/EMGC_OMS<n>/logs/EMGC_OMS<n>.out
OMS log files
$INSTANCE_HOME/sysman/log/emoms_pbs.log
$INSTANCE_HOME/sysman/log/emoms_pbs.trc
$INSTANCE_HOME/sysman/log/emoms.trc
$INSTANCE_HOME/sysman/log/emoms.log
reference:
http://docs.oracle.com/cd/E24628_01/doc.121/e24473/emctl.htm
$ORACLE_HOME/bin/emctl start oms
2. check status
$ORACLE_HOME/bin/emctl status oms
for details (need sysman password)
$ORACLE_HOME/bin/emctl status oms -details
3. shut down
$ORACLE_HOME/bin/emctl stop oms
4. start agent
$ORACLE_AGENT_HOME/agent_inst/bin/emctl start agent
5. check agent status
$ORACLE_AGENT_HOME/agent_inst/bin/emctl status agent
6. stop agent
$ORACLE_AGENT_HOME/agent_inst/bin/emctl stop agent
7. manage server logs
OMS Log File Log File Location
emctl log file:
$INSTANCE_HOME/sysman/log/emctl.log file
Managed Server log files:
$INSTANCE_HOME/user_projects/domains<DOMAIN_NAME>/servers/EMGC_OMS<n>/logs/EMGC_OMS<n>.log
$INSTANCE_HOME/user_projects/domains<DOMAIN_NAME>/servers/EMGC_OMS<n>/logs/EMGC_OMS<n>.out
OMS log files
$INSTANCE_HOME/sysman/log/emoms_pbs.log
$INSTANCE_HOME/sysman/log/emoms_pbs.trc
$INSTANCE_HOME/sysman/log/emoms.trc
$INSTANCE_HOME/sysman/log/emoms.log
reference:
http://docs.oracle.com/cd/E24628_01/doc.121/e24473/emctl.htm
impdp: ORA-39083: Object type TYPE failed to create with error: ORA-02304: invalid object identifier literal
Error Message:
ORA-39083: Object type TYPE failed to create with error:
ORA-02304: invalid object identifier literal
Failing sql is:
CREATE TYPE "TEST"."TTTTT" OID '8E21EF4C1F6EF167E04011AC99643EB0' IS TABLE OF VARCHAR2(40);
This error happened when expdp and impdp a schema to a new one in the same database.
Cause: OID should be unique in a database. the OID in the impdp create statemene was used by old schema.
solution:
1. remove the OID from failing sql and rerun it manually.
2. impdp again with parameter transform=OID:n
reference:
http://www.franklinfaces.com/Topic173-54-1.aspx
ORA-39083: Object type TYPE failed to create with error:
ORA-02304: invalid object identifier literal
Failing sql is:
CREATE TYPE "TEST"."TTTTT" OID '8E21EF4C1F6EF167E04011AC99643EB0' IS TABLE OF VARCHAR2(40);
This error happened when expdp and impdp a schema to a new one in the same database.
Cause: OID should be unique in a database. the OID in the impdp create statemene was used by old schema.
solution:
1. remove the OID from failing sql and rerun it manually.
2. impdp again with parameter transform=OID:n
reference:
http://www.franklinfaces.com/Topic173-54-1.aspx
Monday, May 21, 2012
deinstall oracle fusion middleware
1.shut down all process associateted with the fusion middleware home
./opmnctl stopall
2.in oracle ofm home
./runInstaller -deinstall
Attn: this must be run againt oracle home instead of installatoin binary.
3. select remove home on graphic interface
4. remove remain oracle_common direcotry
rm -rf $ORACLE_OFM_HOME
./opmnctl stopall
2.in oracle ofm home
./runInstaller -deinstall
Attn: this must be run againt oracle home instead of installatoin binary.
3. select remove home on graphic interface
4. remove remain oracle_common direcotry
rm -rf $ORACLE_OFM_HOME
Friday, May 18, 2012
configure oracle application express - oracle 11g
This document is mainly for configure oracle application express on oracle database installation version 11.2.0.2. It also includes some problems I met and their solutions. Hope it will be useful for others.
1. apex is installed defaultly as database installaion.
you can check it with below methods.
select username from dba_users where username like 'APEX%'
sys@TEST.corvus> select username from dba_users where username like 'APEX%';
USERNAME
------------------------------
APEX_PUBLIC_USER
APEX_030200
sys@TEST.corvus> select comp_id, comp_name, version, status from dba_registry where comp_id='APEX';
COMP_ID COMP_NAME VERSION STATUS
------------------------------ ---------------------------------------- ------------------------------ --------------------
APEX Oracle Application Express 3.2.1.00.12 VALID
2. determin the architecture option.
Starting from 11g, there are 3 architectures to configure apex access: oracle applicaiton express listener, HTTP server with mod_plsql and embeded plsql gatway (EPG).
I configured HTTP Server first and EPG later. both can be configured to run at the same time on same server.
the easiest way is to EPG option.
3. configure APEX with HTTP server and mod_plsql architecture
3.1 configure apex on oracle database installation.
cd $ORACLE_HOME/Apex/bin
sqlplus / as sysdba
sqlplus > @apxchpwd # change admin password
sqlplus > alter user apex_public_user account unlock
sqlplus > password apex_public_user
3.2 download oracle http server
#current it is available from version 11.2.0.1 as oracle fussion medtier.
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html
3.3 install http server
./runInstaller # install software only
3.4 configure http server
WebTier_ORAcLE_OME/bin/config.sh #don't select "associate to a domain' if you don't have a domain setup
3.5 load the mod_plsql module
vi WebTier_ORAcLE_OME/instances/instance1/config/OHS/ohs1/httpd.conf
add
LoadModule plsql_module "${ORACLE_HOME}/ohs/modules/mod_plsql.so"
include /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/*.conf
3.6 copy images
cp -rf $ORACLE_HOME/apex/image $ORACLE_HTTPSERVER_HOME/ohs
3.7 configure dads.conf file
vi /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/dads.conf
add
Alias /i/ "/u01/app/oracle/product/4.0.2/apex/images/"
AddType text/xml xbl
AddType text/x-component htc
<Location /pls/apex>
Order deny,allow
PlsqlDocumentPath docs
AllowOverride None
PlsqlDocumentProcedure wwv_flow_file_manager.process_download
PlsqlDatabaseConnectString localhost:1521:XE ServiceNameFormat
PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8
PlsqlAuthenticationMode Basic
SetHandler pls_handler
PlsqlDocumentTablename wwv_flow_file_objects$
PlsqlDatabaseUsername APEX_PUBLIC_USER
PlsqlDefaultPage apex
PlsqlDatabasePassword parsingschemapasswd
PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
Allow from all
</Location>
3.8 stop and start http server
/u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/instances/instance1/bin/opmnctl stopproc ias-component=ohs1
/u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/instances/instance1/bin/opmnctl startproc ias-component=ohs1
3.9 open http port
vi /etc/sysconfig/iptables
add
-A INPUT -m state --state NEW -m tcp -p tcp --dport 7777 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4443 -j ACCEPT
port 777 for http
port 443 for https
3.10 access apex
normal login
https://hostname:4443/pls/apex
http://hostname:7777/pls/apex
admin login
https://hostname:4443/pls/apex/apex_admin
http://hostname:7777/pls/apex/apex_admin
4. configure EPG
EPG use XDB associated HTTP server from oracle database installation so that you don't need download OHS seperately with installation and configuration.
4.1 configue apex
run as sysdba
sql> @?/apex/apxconf
PORT
----------
8080
Enter values below for the XDB HTTP listener port and the password for the Application Express ADMIN user.
Default values are in brackets [ ].
Press Enter to accept the default value.
Enter a password for the ADMIN user []
Enter a port for the XDB HTTP listener [ 8080]
...changing HTTP Port
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Session altered.
...changing password for ADMIN
PL/SQL procedure successfully completed.
Commit complete.
4.2 unlock anonymous user
sql> alter user anonymous account unlock;
you will find the account is expired. if you don't want to login for XML DB funciton, leave it expired. otherwise you might get problem as I got. which make EPG configuration complex.
4.3 check if HTTP server up
sql> select dbms_xdb.gethttpport() from dual;
if it retruns 0, it is down. Then bring it up.
sql> exec dbms_xdb.sethttpport(8080);
if it returns 8080, it is up.
4.5 open port for apex
vi /etc/sysconfig/iptables
add
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
4.4 access apex
normal login
http://hostname:8080/apex
admin login
http://hostname:8080/apex/apex_admin
4.5 check epg status
sql>@?/rdbms/admin/epgstat
+--------------------------------------+
| XDB protocol ports: |
| XDB is listening for the protocol |
| when the protocol port is non-zero. |
+--------------------------------------+
HTTP Port FTP Port
--------- --------
8080 0
1 row selected.
+---------------------------+
| DAD virtual-path mappings |
+---------------------------+
Virtual Path DAD Name
-------------------------------- --------------------------------
/apex/* APEX
1 row selected.
+----------------+
| DAD attributes |
+----------------+
DAD Name DAD Param DAD Value
------------ ------------------------ ----------------------------------------
APEX database-username ANONYMOUS
default-page apex
document-table-name wwv_flow_file_objects$
request-validation-funct wwv_flow_epg_include_modules.authorize
ion
document-procedure wwv_flow_file_mgr.process_download
nls-language american_america.al32utf8
document-path docs
7 rows selected.
+---------------------------------------------------+
| DAD authorization: |
| To use static authentication of a user in a DAD, |
| the DAD must be authorized for the user. |
+---------------------------------------------------+
no rows selected
+----------------------------+
| DAD authentication schemes |
+----------------------------+
DAD Name User Name Auth Scheme
-------------------- -------------------------------- ------------------
APEX ANONYMOUS Anonymous
1 row selected.
+--------------------------------------------------------+
| ANONYMOUS user status: |
| To use static or anonymous authentication in any DAD, |
| the ANONYMOUS account must be unlocked. |
+--------------------------------------------------------+
Database User Status
--------------- --------------------
ANONYMOUS OPEN
1 row selected.
+-------------------------------------------------------------------+
| ANONYMOUS access to XDB repository: |
| To allow public access to XDB repository without authentication, |
| ANONYMOUS access to the repository must be allowed. |
+-------------------------------------------------------------------+
Allow repository anonymous access?
----------------------------------
false
1 row selected.
4.6 debug XDB http server
/*
* Log levels for the global attribute "log-level"
*
* LOG_EMERG CONSTANT PLS_INTEGER := 0;
* LOG_ALERT CONSTANT PLS_INTEGER := 1;
* LOG_CRIT CONSTANT PLS_INTEGER := 2;
* LOG_ERR CONSTANT PLS_INTEGER := 3;
* LOG_WARNING CONSTANT PLS_INTEGER := 4;
* LOG_NOTICE CONSTANT PLS_INTEGER := 5;
* LOG_INFO CONSTANT PLS_INTEGER := 6;
* LOG_DEBUG CONSTANT PLS_INTEGER := 7;
*/
begin
dbms_epg.set_global_attribute(
attr_name => 'log-level',
attr_value => dbms_epg.log_debug
);
end;
/
commit
/
alter troubleshootin, it should be reset to LOG_ALERT
begin
dbms_epg.set_global_attribute(
attr_name => 'log-level',
attr_value => dbms_epg.log_alert
);
end;
/
commit
/
5. troubleshooting
5.1 there is no page displayed when go to https://hostname:4443/apex
check if port is open from server firewall
$> service iptables status | grep 4443
check if http server is up
$> $ORACEL_HTTPSERVER_HOME/instance/instance1/ohs1/bin/emctl status
check if mod_plsql is load in httpd.conf file
check if apex is configured through dads.conf file. dads.conf file need be included in load mod_plsql portion in httpd.conf file
5.2 there is no page displayed when go to https://hostname:8080/apex
It costed me 4 hours to find out the cause.
NOT https but http. there is no https for EPG ( maybe I am wrong, but dufault one is http). so use http://hostname:8080/apex
5.3 there is http-500 error when go to http://hostname:8080/apex even though you can login as ANONYMOUS to view XDB folders.
you will also find below error in database alert file
ORA-00600: internal error code, arguments: [wpemInit_3], [ANONYMOUS], [], [], [], [], [], [], [], [], [], []
This costed me more than 4 hours to find out the cause.
Since you logged in as ANONYMOUS, the browser thinks you are access XDB folder and try to find the page as a folder dispaly of XDB. Of course it is not available.
solution: start a new browser instance or restart browser.
BTW: the best online document I found for EPG configuration and troubleshooting.
http://oraexplorer.com/2007/11/oracle-apex-in-11g-installation/
reference:
http://oraexplorer.com/2007/11/oracle-apex-in-11g-installation/
https://forums.oracle.com/forums/thread.jspa?threadID=983419
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21673/otn_install.htm#BABFICIA
http://docs.oracle.com/cd/E14373_01/install.32/e13366/db_install.htm#CIHGAGGB
http://docs.oracle.com/cd/E14373_01/install.32/e13366/db_install.htm
http://docs.oracle.com/cd/B28359_01/install.111/b28264/apex.htm
http://www.warp11.nl/2011/05/fully-freeware-apex-environment-vii-oracle-http-server-configuration/
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21673/otn_install.htm#BABEGAEJ
https://forums.oracle.com/forums/thread.jspa?threadID=913215
1. apex is installed defaultly as database installaion.
you can check it with below methods.
select username from dba_users where username like 'APEX%'
sys@TEST.corvus> select username from dba_users where username like 'APEX%';
USERNAME
------------------------------
APEX_PUBLIC_USER
APEX_030200
sys@TEST.corvus> select comp_id, comp_name, version, status from dba_registry where comp_id='APEX';
COMP_ID COMP_NAME VERSION STATUS
------------------------------ ---------------------------------------- ------------------------------ --------------------
APEX Oracle Application Express 3.2.1.00.12 VALID
2. determin the architecture option.
Starting from 11g, there are 3 architectures to configure apex access: oracle applicaiton express listener, HTTP server with mod_plsql and embeded plsql gatway (EPG).
I configured HTTP Server first and EPG later. both can be configured to run at the same time on same server.
the easiest way is to EPG option.
3. configure APEX with HTTP server and mod_plsql architecture
3.1 configure apex on oracle database installation.
cd $ORACLE_HOME/Apex/bin
sqlplus / as sysdba
sqlplus > @apxchpwd # change admin password
sqlplus > alter user apex_public_user account unlock
sqlplus > password apex_public_user
3.2 download oracle http server
#current it is available from version 11.2.0.1 as oracle fussion medtier.
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html
3.3 install http server
./runInstaller # install software only
3.4 configure http server
WebTier_ORAcLE_OME/bin/config.sh #don't select "associate to a domain' if you don't have a domain setup
3.5 load the mod_plsql module
vi WebTier_ORAcLE_OME/instances/instance1/config/OHS/ohs1/httpd.conf
add
LoadModule plsql_module "${ORACLE_HOME}/ohs/modules/mod_plsql.so"
include /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/*.conf
3.6 copy images
cp -rf $ORACLE_HOME/apex/image $ORACLE_HTTPSERVER_HOME/ohs
3.7 configure dads.conf file
vi /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/dads.conf
add
Alias /i/ "/u01/app/oracle/product/4.0.2/apex/images/"
AddType text/xml xbl
AddType text/x-component htc
<Location /pls/apex>
Order deny,allow
PlsqlDocumentPath docs
AllowOverride None
PlsqlDocumentProcedure wwv_flow_file_manager.process_download
PlsqlDatabaseConnectString localhost:1521:XE ServiceNameFormat
PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8
PlsqlAuthenticationMode Basic
SetHandler pls_handler
PlsqlDocumentTablename wwv_flow_file_objects$
PlsqlDatabaseUsername APEX_PUBLIC_USER
PlsqlDefaultPage apex
PlsqlDatabasePassword parsingschemapasswd
PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
Allow from all
</Location>
3.8 stop and start http server
/u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/instances/instance1/bin/opmnctl stopproc ias-component=ohs1
/u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/instances/instance1/bin/opmnctl startproc ias-component=ohs1
3.9 open http port
vi /etc/sysconfig/iptables
add
-A INPUT -m state --state NEW -m tcp -p tcp --dport 7777 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 4443 -j ACCEPT
port 777 for http
port 443 for https
3.10 access apex
normal login
https://hostname:4443/pls/apex
http://hostname:7777/pls/apex
admin login
https://hostname:4443/pls/apex/apex_admin
http://hostname:7777/pls/apex/apex_admin
4. configure EPG
EPG use XDB associated HTTP server from oracle database installation so that you don't need download OHS seperately with installation and configuration.
4.1 configue apex
run as sysdba
sql> @?/apex/apxconf
PORT
----------
8080
Enter values below for the XDB HTTP listener port and the password for the Application Express ADMIN user.
Default values are in brackets [ ].
Press Enter to accept the default value.
Enter a password for the ADMIN user []
Enter a port for the XDB HTTP listener [ 8080]
...changing HTTP Port
PL/SQL procedure successfully completed.
PL/SQL procedure successfully completed.
Session altered.
...changing password for ADMIN
PL/SQL procedure successfully completed.
Commit complete.
4.2 unlock anonymous user
sql> alter user anonymous account unlock;
you will find the account is expired. if you don't want to login for XML DB funciton, leave it expired. otherwise you might get problem as I got. which make EPG configuration complex.
4.3 check if HTTP server up
sql> select dbms_xdb.gethttpport() from dual;
if it retruns 0, it is down. Then bring it up.
sql> exec dbms_xdb.sethttpport(8080);
if it returns 8080, it is up.
4.5 open port for apex
vi /etc/sysconfig/iptables
add
-A INPUT -m state --state NEW -m tcp -p tcp --dport 8080 -j ACCEPT
4.4 access apex
normal login
http://hostname:8080/apex
admin login
http://hostname:8080/apex/apex_admin
4.5 check epg status
sql>@?/rdbms/admin/epgstat
+--------------------------------------+
| XDB protocol ports: |
| XDB is listening for the protocol |
| when the protocol port is non-zero. |
+--------------------------------------+
HTTP Port FTP Port
--------- --------
8080 0
1 row selected.
+---------------------------+
| DAD virtual-path mappings |
+---------------------------+
Virtual Path DAD Name
-------------------------------- --------------------------------
/apex/* APEX
1 row selected.
+----------------+
| DAD attributes |
+----------------+
DAD Name DAD Param DAD Value
------------ ------------------------ ----------------------------------------
APEX database-username ANONYMOUS
default-page apex
document-table-name wwv_flow_file_objects$
request-validation-funct wwv_flow_epg_include_modules.authorize
ion
document-procedure wwv_flow_file_mgr.process_download
nls-language american_america.al32utf8
document-path docs
7 rows selected.
+---------------------------------------------------+
| DAD authorization: |
| To use static authentication of a user in a DAD, |
| the DAD must be authorized for the user. |
+---------------------------------------------------+
no rows selected
+----------------------------+
| DAD authentication schemes |
+----------------------------+
DAD Name User Name Auth Scheme
-------------------- -------------------------------- ------------------
APEX ANONYMOUS Anonymous
1 row selected.
+--------------------------------------------------------+
| ANONYMOUS user status: |
| To use static or anonymous authentication in any DAD, |
| the ANONYMOUS account must be unlocked. |
+--------------------------------------------------------+
Database User Status
--------------- --------------------
ANONYMOUS OPEN
1 row selected.
+-------------------------------------------------------------------+
| ANONYMOUS access to XDB repository: |
| To allow public access to XDB repository without authentication, |
| ANONYMOUS access to the repository must be allowed. |
+-------------------------------------------------------------------+
Allow repository anonymous access?
----------------------------------
false
1 row selected.
4.6 debug XDB http server
/*
* Log levels for the global attribute "log-level"
*
* LOG_EMERG CONSTANT PLS_INTEGER := 0;
* LOG_ALERT CONSTANT PLS_INTEGER := 1;
* LOG_CRIT CONSTANT PLS_INTEGER := 2;
* LOG_ERR CONSTANT PLS_INTEGER := 3;
* LOG_WARNING CONSTANT PLS_INTEGER := 4;
* LOG_NOTICE CONSTANT PLS_INTEGER := 5;
* LOG_INFO CONSTANT PLS_INTEGER := 6;
* LOG_DEBUG CONSTANT PLS_INTEGER := 7;
*/
begin
dbms_epg.set_global_attribute(
attr_name => 'log-level',
attr_value => dbms_epg.log_debug
);
end;
/
commit
/
alter troubleshootin, it should be reset to LOG_ALERT
begin
dbms_epg.set_global_attribute(
attr_name => 'log-level',
attr_value => dbms_epg.log_alert
);
end;
/
commit
/
5. troubleshooting
5.1 there is no page displayed when go to https://hostname:4443/apex
check if port is open from server firewall
$> service iptables status | grep 4443
check if http server is up
$> $ORACEL_HTTPSERVER_HOME/instance/instance1/ohs1/bin/emctl status
check if mod_plsql is load in httpd.conf file
check if apex is configured through dads.conf file. dads.conf file need be included in load mod_plsql portion in httpd.conf file
5.2 there is no page displayed when go to https://hostname:8080/apex
It costed me 4 hours to find out the cause.
NOT https but http. there is no https for EPG ( maybe I am wrong, but dufault one is http). so use http://hostname:8080/apex
5.3 there is http-500 error when go to http://hostname:8080/apex even though you can login as ANONYMOUS to view XDB folders.
you will also find below error in database alert file
ORA-00600: internal error code, arguments: [wpemInit_3], [ANONYMOUS], [], [], [], [], [], [], [], [], [], []
This costed me more than 4 hours to find out the cause.
Since you logged in as ANONYMOUS, the browser thinks you are access XDB folder and try to find the page as a folder dispaly of XDB. Of course it is not available.
solution: start a new browser instance or restart browser.
BTW: the best online document I found for EPG configuration and troubleshooting.
http://oraexplorer.com/2007/11/oracle-apex-in-11g-installation/
reference:
http://oraexplorer.com/2007/11/oracle-apex-in-11g-installation/
https://forums.oracle.com/forums/thread.jspa?threadID=983419
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21673/otn_install.htm#BABFICIA
http://docs.oracle.com/cd/E14373_01/install.32/e13366/db_install.htm#CIHGAGGB
http://docs.oracle.com/cd/E14373_01/install.32/e13366/db_install.htm
http://docs.oracle.com/cd/B28359_01/install.111/b28264/apex.htm
http://www.warp11.nl/2011/05/fully-freeware-apex-environment-vii-oracle-http-server-configuration/
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21673/otn_install.htm#BABEGAEJ
https://forums.oracle.com/forums/thread.jspa?threadID=913215
Thursday, May 17, 2012
find command
find . -type f -mtime +30 -name test\* -exec rm {} \;
-iname ( insecitive name pattern) -exec will treat line by line return from find.
$ find / -name 'program.c' 2>/dev/null
$ find / -name 'program.c' 2>errors.txt
$ find /home/david -name 'index*'
$ find /home/david -iname 'index*'
$ find -name met*
$ find /mp3collection -name '*.mp3' -size -5000k
$ find / -size +10000k
$ find /home/david -amin -10 -name '*.c'
$ find /home/david -atime -2 -name '*.c'
$ find /home/david -mmin -10 -name '*.c'
$ find /home/david -mtime -2 -name '*.c'
$ find / -mount -name 'win*'
$ find /mp3-collection -name 'Metallica*' -and -size +10000k
$ find /mp3-collection -size +10000k ! -name "Metallica*"
$ find /mp3-collection -name 'Metallica*' -or -size +10000k
$ find / - name 'Metallica*' -exec ls -l {\}\ \;
referenc:
http://linux.about.com/od/commands/l/blcmdl1_find.htm
http://www.codecoffee.com/tipsforlinux/articles/21.html
-iname ( insecitive name pattern) -exec will treat line by line return from find.
$ find / -name 'program.c' 2>/dev/null
$ find / -name 'program.c' 2>errors.txt
$ find /home/david -name 'index*'
$ find /home/david -iname 'index*'
$ find -name met*
$ find /mp3collection -name '*.mp3' -size -5000k
$ find / -size +10000k
$ find /home/david -amin -10 -name '*.c'
$ find /home/david -atime -2 -name '*.c'
$ find /home/david -mmin -10 -name '*.c'
$ find /home/david -mtime -2 -name '*.c'
$ find / -mount -name 'win*'
$ find /mp3-collection -name 'Metallica*' -and -size +10000k
$ find /mp3-collection -size +10000k ! -name "Metallica*"
$ find /mp3-collection -name 'Metallica*' -or -size +10000k
$ find / - name 'Metallica*' -exec ls -l {\}\ \;
referenc:
http://linux.about.com/od/commands/l/blcmdl1_find.htm
http://www.codecoffee.com/tipsforlinux/articles/21.html
application express installation -http server option
1. configure apex on oracle database installation.
cd $ORACLE_HOME/Apex/bin
sqlplus / as sysdba
sqlplus > @apxchpwd # change admin password
sqlplus > alter user apex_public_user account unlock
sqlplus > password apex_public_user
2. download oracle http server
#current it is available from version 11.2.0.1 as oracle fussion medtier.
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html
3. install http server
./runInstaller # install software only
4. configure http server
WebTier_ORAcLE_OME/bin/config.sh #don't select "associate to a domain' if you don't have a domain setup
5. load the mod_plsql module
vi WebTier_ORAcLE_OME/instances/instance1/config/OHS/ohs1/httpd.conf
add
LoadModule plsql_module "${ORACLE_HOME}/ohs/modules/mod_plsql.so"
include /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/*.conf
6. configure dads.conf file
vi /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/dads.conf
add
Alias /i/ "/u01/app/oracle/product/4.0.2/apex/images/"
AddType text/xml xbl
AddType text/x-component htc
<Location /pls/apex>
Order deny,allow
PlsqlDocumentPath docs
AllowOverride None
PlsqlDocumentProcedure wwv_flow_file_manager.process_download
PlsqlDatabaseConnectString localhost:1521:XE ServiceNameFormat
PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8
PlsqlAuthenticationMode Basic
SetHandler pls_handler
PlsqlDocumentTablename wwv_flow_file_objects$
PlsqlDatabaseUsername APEX_PUBLIC_USER
PlsqlDefaultPage apex
PlsqlDatabasePassword parsingschemapasswd
PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
Allow from all
</Location>
7. stop and start http server
/u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/instances/instance1/bin/opmnctl stopproc ias-component=ohs1
/u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/instances/instance1/bin/opmnctl startproc ias-component=ohs1
8. access application express at https://hostname:4443/pls/apex
reference:
http://docs.oracle.com/cd/B28359_01/install.111/b28264/apex.htm
http://www.warp11.nl/2011/05/fully-freeware-apex-environment-vii-oracle-http-server-configuration/
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21673/otn_install.htm#BABEGAEJ
cd $ORACLE_HOME/Apex/bin
sqlplus / as sysdba
sqlplus > @apxchpwd # change admin password
sqlplus > alter user apex_public_user account unlock
sqlplus > password apex_public_user
2. download oracle http server
#current it is available from version 11.2.0.1 as oracle fussion medtier.
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-linx8664soft-100572.html
3. install http server
./runInstaller # install software only
4. configure http server
WebTier_ORAcLE_OME/bin/config.sh #don't select "associate to a domain' if you don't have a domain setup
5. load the mod_plsql module
vi WebTier_ORAcLE_OME/instances/instance1/config/OHS/ohs1/httpd.conf
add
LoadModule plsql_module "${ORACLE_HOME}/ohs/modules/mod_plsql.so"
include /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/*.conf
6. configure dads.conf file
vi /u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/ohs/conf/mod_plsql/dads.conf
add
Alias /i/ "/u01/app/oracle/product/4.0.2/apex/images/"
AddType text/xml xbl
AddType text/x-component htc
<Location /pls/apex>
Order deny,allow
PlsqlDocumentPath docs
AllowOverride None
PlsqlDocumentProcedure wwv_flow_file_manager.process_download
PlsqlDatabaseConnectString localhost:1521:XE ServiceNameFormat
PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8
PlsqlAuthenticationMode Basic
SetHandler pls_handler
PlsqlDocumentTablename wwv_flow_file_objects$
PlsqlDatabaseUsername APEX_PUBLIC_USER
PlsqlDefaultPage apex
PlsqlDatabasePassword parsingschemapasswd
PlsqlRequestValidationFunction wwv_flow_epg_include_modules.authorize
Allow from all
</Location>
7. stop and start http server
/u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/instances/instance1/bin/opmnctl stopproc ias-component=ohs1
/u01/app/oracle/product/11.1.1/ofm/Oracle_WT1/instances/instance1/bin/opmnctl startproc ias-component=ohs1
8. access application express at https://hostname:4443/pls/apex
reference:
http://docs.oracle.com/cd/B28359_01/install.111/b28264/apex.htm
http://www.warp11.nl/2011/05/fully-freeware-apex-environment-vii-oracle-http-server-configuration/
http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21673/otn_install.htm#BABEGAEJ
ARC1: Error 19809 - ORA-19809 or ORA-00257
Following error message appears in alert log file:
then consider changing RMAN ARCHIVELOG DELETION POLICY.
2. Back up files to tertiary device such as tape using RMAN
BACKUP RECOVERY AREA command.
3. Add disk space and increase db_recovery_file_dest_size parameter to
reflect the new space.
4. Delete unnecessary files using RMAN DELETE command. If an operating
system command was used to delete files, then use RMAN CROSSCHECK and
DELETE EXPIRED commands.
************************************************************************
ARC1: Error 19809 Creating archive log file to '+DATA'
or in ohs1.log for fusion middle tier
How to solve ORA-00257 archiver error. Connect internal only, until freed.
Root cause: flash recovery area is full.
solution: you need delete files from flash recovery area through rman. If you delete them through os, you need run rman crosscheck and delete expired.
Concern: good thing is flash recovery will prevent database from using up all disk space when something wrong happens. So os or other applcation will not be affected by database issue. Bad thing is flash recovery area is always less than availabe disk in server. it will generate more database freeze because of the small buffer size.
check flash recovery area usage:
set lines 100 col name format a60 select name , floor(space_limit / 1024 / 1024) "Size MB" , ceil(space_used / 1024 / 1024) "Used MB" from v$recovery_file_dest order by name /
delete archive log through rman:
rman> delete archivelog until time 'trunc(sysdate -1)'
reference:
Tuesday, May 8, 2012
set up putty key login
1. generate key pair from server side or from putty side
ssh-keygen
2. put public key into serverside
cat id_rsa.pub >> ~/.ssh/authorized_keys2
remove your email from the end.
3. set up putty session with private key.
reference:
http://www.howtoforge.com/how-to-configure-ssh-keys-authentication-with-putty-and-linux-server-in-5-quick-steps
Monday, May 7, 2012
disable/enable oracle option.
1. look at current options
select * from v$option;
2. in oracle home bin
shutdown all database
chopt enable partitioning
start all database.
this will relink oracle binary.
reference:
http://www.liberidu.com/blog/2010/05/30/enabling-and-disabling-database-options/
select * from v$option;
2. in oracle home bin
shutdown all database
chopt enable partitioning
start all database.
this will relink oracle binary.
reference:
http://www.liberidu.com/blog/2010/05/30/enabling-and-disabling-database-options/
Friday, May 4, 2012
install cloud control management agent
1. create software package.
this must be done on OMS server
this must be done on OMS server
$<OMS_HOME>/bin/emcli login -username=sysman -password=<password>
$<OMS_HOME>/bin/emcli sync
$<OMS_HOME>/bin/emcli get_supported_platforms
./emcli get_agentimage -destination=/tmp -platform="Linux x86" -version=12.1.0.1.0
2. transfer the file to destinated host
3. unzip it
4. edit agent.rsp file
EM_INSTALL_TYPE="AGENT"
OMS_HOST="test.test.com"
EM_UPLOAD_PORT="4889"
AGENT_REGISTRATION_PASSWORD="test"
AGENT_INSTANCE_HOME="/u01/app/oem12c"
AGENT_PORT="1830"
ORACLE_HOSTNAME="test1.test.com"
s_agentHomeName="agent12gR1"
s_agentServiceName="Oracleagent12gR1agent"
5. run deploy command
./agentDelopy AGENT_BASE_DIR=/u01/app/oem12c RESPONSE_FILE=/u01/app/oem12c/stage/agent.rsp
reset password with value
This methods is used to clone user with the same password or reset user to same password to clear account expired status.
select dbms_metadata.get_ddl('USER','TEST') from dual;
CREATE USER "TEST" IDENTIFIED BY VALUES 'S:C0ACFA8BB332DAA8ACF469B7C9F2AB07623B3C5358DB1ABCE05C1FCE057E;BDCFAC041379F0D9'
DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP"
quota unlimited on users;
grant resource, connect, test_profile to test;
alter user coskan identified by VALUES 'S:1F0648E7E665F0A0EE44B1E9BD4B626A77CA25B376A49177F9E97DF98BFA;26EB15F771A78542';
select password,spare4 from user$ where name='U';
alter system set sec_case_sensitive_logon=true;
S:1F0648E7E665F0A0EE44B1E9BD4B626A77CA25B376A49177F9E97DF98BFA -- for sensitive
26EB15F771A78542 -- for non-sensitive
if set up only non-sensitive, sec_case_sensitive_logon=true will not work.
select dbms_metadata.get_ddl('USER','TEST') from dual;
CREATE USER "TEST" IDENTIFIED BY VALUES 'S:C0ACFA8BB332DAA8ACF469B7C9F2AB07623B3C5358DB1ABCE05C1FCE057E;BDCFAC041379F0D9'
DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP"
quota unlimited on users;
grant resource, connect, test_profile to test;
alter user coskan identified by VALUES 'S:1F0648E7E665F0A0EE44B1E9BD4B626A77CA25B376A49177F9E97DF98BFA;26EB15F771A78542';
select password,spare4 from user$ where name='U';
alter system set sec_case_sensitive_logon=true;
S:1F0648E7E665F0A0EE44B1E9BD4B626A77CA25B376A49177F9E97DF98BFA -- for sensitive
26EB15F771A78542 -- for non-sensitive
if set up only non-sensitive, sec_case_sensitive_logon=true will not work.
Thursday, May 3, 2012
list file with absolute path
ls -l -1 $PWD/filename
-l long format
-1 list one file per line
-d list direcotry
reference:
http://stackoverflow.com/questions/3335431/list-files-with-absolute-path-recursive-in-linux
http://stackoverflow.com/questions/246215/how-can-i-list-files-with-their-absolute-path-in-linux
-l long format
-1 list one file per line
-d list direcotry
reference:
http://stackoverflow.com/questions/3335431/list-files-with-absolute-path-recursive-in-linux
http://stackoverflow.com/questions/246215/how-can-i-list-files-with-their-absolute-path-in-linux
Subscribe to:
Posts (Atom)