Tuesday, June 29, 2010

Add Disk with ORA-15054 After ORA-15075

Tested add new disk to ASM Disk Group on 10gR2 RAC 4 nodes, I assumed I have only one node see ASM new Disk (DATA_NEW).
SQL> ALTER DISKGROUP DATA ADD DISK 'ORCL:DATA_NEW';
ALTER DISKGROUP DATA ADD DISK 'ORCL:DATA_NEW'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15075: disk(s) are not visible cluster-wide
In alert log file:
Tue Jun 29 12:47:24 2010
SQL> ALTER DISKGROUP DATA ADD DISK 'ORCL:DATA_NEW'
Tue Jun 29 12:47:24 2010
NOTE: reconfiguration of group 1/0x933863a4 (DATA), full=1
Tue Jun 29 12:47:24 2010
NOTE: initializing header on grp 1 disk DATA_NEW
NOTE: cache opening disk 1 of grp 1: DATA_NEW label:DATA_NEW
NOTE: PST update: grp = 1
NOTE: requesting all-instance disk validation for group=1
Tue Jun 29 12:47:24 2010
NOTE: disk validation pending for group 1/0x933863a4 (DATA)
SUCCESS: validated disks for 1/0x933863a4 (DATA)
Tue Jun 29 12:47:26 2010
NOTE: requesting all-instance PST refresh for group=1
Tue Jun 29 12:47:26 2010
NOTE: PST refresh pending for group 1/0x933863a4 (DATA)
SUCCESS: refreshed PST for 1/0x933863a4 (DATA)
Tue Jun 29 12:47:29 2010
WARNING: offlining disk 1.3915944791 (DATA_NEW) with mask 0x3
NOTE: PST update: grp = 1, dsk = 1, mode = 0x6
Tue Jun 29 12:47:29 2010
NOTE: PST enabling heartbeating (grp 1)
Tue Jun 29 12:47:29 2010
NOTE: PST update: grp = 1, dsk = 1, mode = 0x4
NOTE: cache closing disk 1 of grp 1: DATA_NEW
Tue Jun 29 12:47:31 2010
Reconfiguration started (old inc 16, new inc 17)
List of nodes:
That made ASM other nodes failed... Oops!!!
Then I made all nodes see ASM new Disk (DATA_NEW) and added...
SQL> ALTER DISKGROUP DATA ADD DISK 'ORCL:DATA_NEW';
ALTER DISKGROUP DATA ADD DISK 'ORCL:DATA_NEW'
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15033: disk 'ORCL:DATA_NEW' belongs to diskgroup "DATA"
What's wrong?
SQL> ALTER DISKGROUP DATA drop disk DATA_NEW;
ALTER DISKGROUP DATA drop disk DATA_NEW
*
ERROR at line 1:
ORA-15032: not all alterations performed
ORA-15054: disk "DATA_NEW" does not exist in diskgroup "DATA"
Read on How to Confuse ASM, idea to "dd" disk, Great Idea ^ ^
OK ... about "DATA_NEW" (asmlib) = /dev/emcpowerc1
# dd if=/dev/zero of=/dev/emcpowerc1 bs=4k count=20000
then added Disk again:
SQL> ALTER DISKGROUP DATA ADD DISK 'ORCL:DATA_NEW';

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- -----------
1 REBAL RUN 1 1 96 15988 1680 9

SQL> ALTER DISKGROUP DATA REBALANCE POWER 7;

Diskgroup altered.

SQL> select * from v$asm_operation;

GROUP_NUMBER OPERA STAT POWER ACTUAL SOFAR EST_WORK EST_RATE EST_MINUTES
------------ ----- ---- ---------- ---------- ---------- ---------- ---------- -----------
1 REBAL RUN 7 7 794 15564 2289 6
OK... we should see new Disk from all nodes before add Disk

Thursday, June 24, 2010

Install APEX 4.0 with Embedded PL/SQL Gateway

Oracle® Application Express Release 4.0 Now Available
Time to upgrade APEX on my database:
SQL> 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.10 VALID
- Download and start to APEX 4.0 (documents):
*** created "APEX" tablespace ***
$ unzip apex_4.0.zip
$ cd apex
$ sqlplus /nolog
SQL> connect / as sysdba
SQL> @apexins APEX APEX TEMP /i/
- Change the Password for the ADMIN Account:
SQL> @apxchpwd
Enter a value below for the password for the Application Express ADMIN user.

Enter a password for the ADMIN user []

Session altered.

...changing password for ADMIN

PL/SQL procedure successfully completed.

Commit complete.
*** using Embedded PL/SQL Gateway ***
- Running the apex_epg_config.sql Configuration Script (unzipped source at /tmp ):
SQL> @apex_epg_config /tmp

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

Directory created.

PL/SQL procedure successfully completed.

Commit complete.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

timing for: Load Images
Elapsed: 00:03:00.52

Session altered.

PL/SQL procedure successfully completed.

Commit complete.

Session altered.

Directory dropped.
- Unlock the ANONYMOUS account:
SQL> ALTER USER ANONYMOUS ACCOUNT UNLOCK;

User altered.
- Update the Images Directory When Upgrading from a Previous Release (nzipped source at /tmp ):
SQL> @apxldimg.sql /tmp

PL/SQL procedure successfully completed.

Directory created.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

PL/SQL procedure successfully completed.

Commit complete.

timing for: Load Images
Elapsed: 00:02:09.70

Directory dropped.
- Enable Oracle XML DB HTTP Server:
SQL> SELECT DBMS_XDB.GETHTTPPORT FROM DUAL;

GETHTTPPORT
-----------
0

SQL> EXEC DBMS_XDB.SETHTTPPORT(8080);

PL/SQL procedure successfully completed.

SQL> !lsnrctl status | grep HTTP
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=linuxtest01)(PORT=8080))(Presentation=HTTP)(Session=RAW))
- Enable Network Services in Oracle Database 11g:
(Grant connect privileges to any host for the APEX_040000 database user)
DECLARE
ACL_PATH VARCHAR2(4000);
ACL_ID RAW(16);
BEGIN
-- Look for the ACL currently assigned to '*' and give APEX_040000
-- the "connect" privilege if APEX_040000 does not have the privilege yet.

SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = '*' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;

-- Before checking the privilege, ensure that the ACL is valid
-- (for example, does not contain stale references to dropped users).
-- If it does, the following exception will be raised:
--
-- ORA-44416: Invalid ACL: Unresolved principal 'APEX_040000'
-- ORA-06512: at "XDB.DBMS_XDBZ", line ...
--
SELECT SYS_OP_R2O(extractValue(P.RES, '/Resource/XMLRef')) INTO ACL_ID
FROM XDB.XDB$ACL A, PATH_VIEW P
WHERE extractValue(P.RES, '/Resource/XMLRef') = REF(A) AND
EQUALS_PATH(P.RES, ACL_PATH) = 1;

DBMS_XDBZ.ValidateACL(ACL_ID);
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_040000',
'connect') IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'APEX_040000', TRUE, 'connect');
END IF;

EXCEPTION
-- When no ACL has been assigned to '*'.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('power_users.xml',
'ACL that lets power users to connect to everywhere',
'APEX_040000', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('power_users.xml','*');
END;
/
COMMIT;
Enable indexing the Oracle Application Express Online Help and could possibly enable email and PDF printing if those servers were also on the local host.
DECLARE
ACL_PATH VARCHAR2(4000);
ACL_ID RAW(16);
BEGIN
-- Look for the ACL currently assigned to 'localhost' and give APEX_040000
-- the "connect" privilege if APEX_040000 does not have the privilege yet.
SELECT ACL INTO ACL_PATH FROM DBA_NETWORK_ACLS
WHERE HOST = 'localhost' AND LOWER_PORT IS NULL AND UPPER_PORT IS NULL;

-- Before checking the privilege, ensure that the ACL is valid
-- (for example, does not contain stale references to dropped users).
-- If it does, the following exception will be raised:
--
-- ORA-44416: Invalid ACL: Unresolved principal 'APEX_040000'
-- ORA-06512: at "XDB.DBMS_XDBZ", line ...
--

SELECT SYS_OP_R2O(extractValue(P.RES, '/Resource/XMLRef')) INTO ACL_ID
FROM XDB.XDB$ACL A, PATH_VIEW P
WHERE extractValue(P.RES, '/Resource/XMLRef') = REF(A) AND
EQUALS_PATH(P.RES, ACL_PATH) = 1;

DBMS_XDBZ.ValidateACL(ACL_ID);
IF DBMS_NETWORK_ACL_ADMIN.CHECK_PRIVILEGE(ACL_PATH, 'APEX_040000',
'connect') IS NULL THEN
DBMS_NETWORK_ACL_ADMIN.ADD_PRIVILEGE(ACL_PATH,
'APEX_040000', TRUE, 'connect');
END IF;

EXCEPTION
-- When no ACL has been assigned to 'localhost'.
WHEN NO_DATA_FOUND THEN
DBMS_NETWORK_ACL_ADMIN.CREATE_ACL('local-access-users.xml',
'ACL that lets power users to connect to everywhere',
'APEX_040000', TRUE, 'connect');
DBMS_NETWORK_ACL_ADMIN.ASSIGN_ACL('local-access-users.xml','localhost');
END;
/
COMMIT;
- Enable Indexing of Online Help in Oracle Database 11gR2 and Higher:
SQL> SELECT par_value FROM ctxsys.ctx_parameters WHERE par_name = 'FILE_ACCESS_ROLE';

PAR_VALUE
----------------------------------------------------------------------------------------------------------------------------------
<Not Found>

SQL> CREATE ROLE APEX_URL_DATASTORE_ROLE;

Role created.

SQL> GRANT APEX_URL_DATASTORE_ROLE to APEX_040000;

Grant succeeded.

SQL> EXEC ctxsys.ctx_adm.set_parameter('file_access_role', 'APEX_URL_DATASTORE_ROLE');

PL/SQL procedure successfully completed.

SQL> SELECT par_value FROM ctxsys.ctx_parameters WHERE par_name = 'FILE_ACCESS_ROLE';

PAR_VALUE
----------------------------------------------------------------------------------------------------------------------------------
APEX_URL_DATASTORE_ROLE
- Task for Upgrade:
SQL> SELECT username
FROM dba_users
WHERE (username LIKE 'FLOWS_%' OR USERNAME LIKE 'APEX_%')
AND USERNAME NOT IN (
SELECT 'FLOWS_FILES'
FROM DUAL
UNION
SELECT 'APEX_PUBLIC_USER' FROM DUAL
UNION
SELECT SCHEMA s
FROM dba_registry
WHERE comp_id = 'APEX');

USERNAME
------------------------------
APEX_030200
FLOWS_030000

SQL> DROP USER FLOWS_030000 cascade;

User dropped.

SQL> DROP USER APEX_030200 cascade;

User dropped.
Fix Invalid ACL in Oracle Database 11g:
EXEC DBMS_NETWORK_ACL_ADMIN.DELETE_PRIVILEGE('power_users.xml', 'FLOWS_030000');
Time to test...


Check in DBA_REGISTRY:
SQL> SELECT COMP_ID, COMP_NAME, VERSION, STATUS from DBA_REGISTRY WHERE COMP_ID='APEX';

COMP_ID COMP_NAME VERSION STATUS
------------------------------ ------------------------------ ------------------------------ ----------
APEX Oracle Application Express 4.0.0.00.46 VALID
:)

Wednesday, June 23, 2010

Oracle Application Express Release 4.0

Oracle Application Express Release 4.0 was released on June 23, 2010.
APEX 4.0 is supported on all Editions (SE1, SE, EE, and XE) of the Oracle database, 10.2.0.3 or higher. Application Express 4.0 can also be used with Oracle Database 10g Express Edition.
We can Download and learn more... New Features

Tuesday, June 22, 2010

Oracle Application Express 3.2 – The Essentials and More Book

Oracle Application Express(Oracle APEX), formerly called HTML DB, is a rapid web application development tool for the Oracle database. Using only a web browser and limited programming experience, we can develop and deploy professional applications that are both fast and secure.
I mention a book titles "Oracle Application Express 3.2 – The Essentials and More" written by Arie Geller and Matthew Lyon. We can see Arie Geller on OTN Forums(APEX), He's helped many people.

The "Oracle Application Express 3.2 – The Essentials and More" book has 24 chapters: APEX Basic Concepts, The Application Builder Basic Concepts and Building Blocks, APEX Best Practices and ...

This book is an essential APEX for developers, web developers and who wish to learn web applications in the Oracle environment.

What we will learn from this book:
- Fully utilize the Web development aspects of APEX by getting familiar with necessary skills such as HTML, the DOM, CSS, and JavaScript
- Understand important concepts of APEX such as Session State, Substitution Strings, the Shortcuts mechanism, and more
- Create the APEX application building blocks, like pages, items, processes, data validation, shared components, and others, and use them to implement the User Interface and the application (business) logic
- Generate APEX Forms and modify them to your needs using the APEX wizards
- Build, display, and validate a Tabular Form, manually as well as using a wizard
- Create and modify Interactive Reports
- Understand the AJAX concepts, such as XMLHttpRequest, communication, and data format, in order to enhance users' experience, and to optimize application performance
- Secure your applications using Authentication Schemes, Authorization Schemes, Session State Protection, and Security Attributes
- Build localized and/or multi-lingual applications using the APEX Globalization support, including the APEX built-in translation mechanism
- Convert Microsoft Access and Oracle Forms applications to APEX applications
- Explore APEX SQL Workshop via its modules such as Object Browser, SQL Commands, SQL Scripts, and Query Builder, and learn how to use them to build the database infrastructure and support for your application
- Implement AJAX in APEX with the help of detailed working examples

Wednesday, June 16, 2010

A result cache + RESULT_CACHE_MAX_SIZE + ...

A result cache is an area of memory, either in the SGA or client application memory.
Server Result Cache
Initialization Parameters (we should know):
- RESULT_CACHE_MAX_SIZE
This parameter sets the memory allocated to the server result cache.
A result cache is in the shared pool. The RESULT_CACHE_MAX_SIZE initialization parameter is parameter for the maximum size of the result cache component of the SGA, if RESULT_CACHE_MAX_SIZE is 0 upon instance startup, the result cache is diabled.
SQL> show parameter result_cache_max_size

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
result_cache_max_size big integer 3136 K

SQL> SELECT dbms_result_cache.status() FROM dual;

DBMS_RESULT_CACHE.STATUS()
--------------------------------------------------------------------------------
ENABLED

SQL> alter system set result_cache_max_size=0;

System altered.

SQL> SELECT dbms_result_cache.status() FROM dual;

DBMS_RESULT_CACHE.STATUS()
--------------------------------------------------------------------------------
BYPASS
A result cache status is "BYPASS".
If STOP/START instance. Then
SQL> show parameter result_cache_max_size

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
result_cache_max_size big integer 0

SQL> SELECT dbms_result_cache.status() FROM dual;

DBMS_RESULT_CACHE.STATUS()
--------------------------------------------------------------------------------
DISABLED
A result cache status is "DISABLED".
If the result cache is disabled and use an ALTER SYSTEM statement to set RESULT_CACHE_MAX_SIZE to a nonzero value but do not restart the database, querying the value of the RESULT_CACHE_MAX_SIZE parameter returns a nonzero value even though the result cache is still disabled. The value of RESULT_CACHE_MAX_SIZE is therefore not the most reliable way to determine if the result cache is enabled.
SQL> alter system set result_cache_max_size=3M;

System altered.

SQL> SELECT dbms_result_cache.status() FROM dual;

DBMS_RESULT_CACHE.STATUS()
--------------------------------------------------------------------------------
DISABLED

SQL> SELECT /*+ RESULT_CACHE */ department_id, AVG(salary) FROM hr.employees GROUP BY department_id;

Execution Plan
----------------------------------------------------------
Plan hash value: 1192169904
--------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 11 | 77 | 4 (25)| 00:00:01 |
| 1 | HASH GROUP BY | | 11 | 77 | 4 (25)| 00:00:01 |
| 2 | TABLE ACCESS FULL| EMPLOYEES | 107 | 749 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------------
still... "DISABLED", so STOP/START instance again.
SQL> SELECT dbms_result_cache.status() FROM dual;

DBMS_RESULT_CACHE.STATUS()
--------------------------------------------------------------------------------
ENABLED

SQL> SELECT /*+ RESULT_CACHE */ department_id, AVG(salary) FROM hr.employees GROUP BY department_id;

Execution Plan
----------------------------------------------------------
Plan hash value: 1192169904
--------------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
--------------------------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | 11 | 77 | 4 (25)| 00:00:01 |
| 1 | RESULT CACHE | 3w0d0687vphfr3gvhgbcpfg89s | | | | |
| 2 | HASH GROUP BY | | 11 | 77 | 4 (25)| 00:00:01 |
| 3 | TABLE ACCESS FULL| EMPLOYEES | 107 | 749 | 3 (0)| 00:00:01 |
--------------------------------------------------------------------------------------------------
A result cache status is "ENABLED", then check:

SQL> SELECT ID, TYPE, CREATION_TIMESTAMP, BLOCK_COUNT, COLUMN_COUNT, PIN_COUNT, ROW_COUNT FROM V$RESULT_CACHE_OBJECTS WHERE CACHE_ID = '3w0d0687vphfr3gvhgbcpfg89s';

ID TYPE CREATION_ BLOCK_COUNT COLUMN_COUNT PIN_COUNT ROW_COUNT
---------- ---------- --------- ----------- ------------ ---------- ----------
1 Result 16-JUN-10 1 2 0 12
That showed some situation of the result cache with RESULT_CACHE_MAX_SIZE initialization parameter.

- RESULT_CACHE_MAX_RESULT
This parameter sets the maximum amount of server result cache memory that can be used for for a single result. The default is 5%, but you can specify any percentage value between 1 and 100. You can set this parameter at the system or session level.
SQL> show parameter RESULT_CACHE_MAX_RESULT

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
result_cache_max_result integer 5
- RESULT_CACHE_REMOTE_EXPIRATION
This parameter specifies the expiration time for a result in the server result cache that depends on remote database objects. The default value is 0 minutes, which implies that results using remote objects should not be cached.

We can manage memory for the server result cache by using DBMS_RESULT_CACHE package.
Example: Check result cache report and flush
SQL> set serverout on
SQL> exec dbms_result_cache.memory_report;
R e s u l t C a c h e M e m o r y R e p o r t
[Parameters]
Block Size = 1K bytes
Maximum Cache Size = 3M bytes (3K blocks)
Maximum Result Size = 153K bytes (153 blocks)
[Memory]
Total Memory = 158360 bytes [0.033% of the Shared Pool]
... Fixed Memory = 10696 bytes [0.002% of the Shared Pool]
... Dynamic Memory = 147664 bytes [0.030% of the Shared Pool]
....... Overhead = 114896 bytes
....... Cache Memory = 32K bytes (32 blocks)
........... Unused Memory = 30 blocks
........... Used Memory = 2 blocks
............... Dependencies = 1 blocks (1 count)
............... Results = 1 blocks
................... SQL = 1 blocks (1 count)

PL/SQL procedure successfully completed.

SQL> exec dbms_result_cache.flush;

PL/SQL procedure successfully completed.

SQL> exec dbms_result_cache.memory_report;
R e s u l t C a c h e M e m o r y R e p o r t
[Parameters]
Block Size = 1K bytes
Maximum Cache Size = 3M bytes (3K blocks)
Maximum Result Size = 153K bytes (153 blocks)
[Memory]
Total Memory = 10696 bytes [0.002% of the Shared Pool]
... Fixed Memory = 10696 bytes [0.002% of the Shared Pool]
... Dynamic Memory = 0 bytes [0.000% of the Shared Pool]

PL/SQL procedure successfully completed.

Thursday, June 03, 2010

DDL on Tables Enabled for Flashback Data Archive

On 11gR2, Flashback Data Archive supports many DDL statements. A Flashback Data Archive is feature on 11g.
SQL> create table tb_recall (id number, name varchar2(50));

Table created.

SQL> alter table tb_recall flashback archive fla1;

Table altered.

SQL> insert into tb_recall values (1,'surachart');

1 row created.

SQL> commit;

Commit complete.

SQL> alter table tb_recall add (address varchar2(100));

Table altered.

SQL> truncate table tb_recall;
truncate table tb_recall
*
ERROR at line 1:
ORA-55610: Invalid DDL statement on history-tracked table

SQL> alter table tb_recall rename to tb_recall_new;
alter table tb_recall rename to tb_recall_new
*
ERROR at line 1:
ORA-55610: Invalid DDL statement on history-tracked table
can't use "TRUNCATE", "RENAME" table on 11gR1, then on 11gR2:
SQL> create tablespace tbs_fla1 datafile size 1G;

Tablespace created.

SQL> create flashback archive fla1 tablespace tbs_fla1 retention 1 year;

Flashback archive created.

SQL> insert into tb_recall values ('1','surachart');

1 row created.

SQL> commit;

Commit complete.

SQL> !date
Thu Jun 3 15:45:00 ICT 2010

SQL> alter table tb_recall add (address varchar2(100));

Table altered.

SQL> truncate table tb_recall;

Table truncated.

SQL> alter table tb_recall rename to tb_recall_new;

Table altered.

SQL> select count(*) from tb_recall_new;

COUNT(*)
----------
0

SQL> select count(*) from tb_recall_new as of timestamp to_timestamp ('2010-06-03:15:45:00', 'yyyy-mm-dd:hh24:mi:ss');

COUNT(*)
----------
1
We can use truncate and rename table.
SQL> alter table tb_recall_new add (zip varchar2(10));

Table altered.

SQL> insert into tb_recall_new values(1,'surachart','999','10400');

1 row created.

SQL> commit;

Commit complete.

SQL> !date
Thu Jun 3 16:01:41 ICT 2010

SQL> alter table tb_recall_new drop column zip;

Table altered.

SQL> select * from tb_recall_new;

ID NAME ADDRESS
---------- ------------------------------ ---------------
1 surachart 999
didn't see column(ZIP), then checked at '2010-06-03:16:02:00'
SQL> select * from tb_recall_new as of timestamp to_timestamp ('2010-06-03:16:02:00', 'yyyy-mm-dd:hh24:mi:ss');

ID NAME ADDRESS ZIP
---------- ------------------------------ --------------- ----------
1 surachart 999 10400
How? if we re- add column (old name).
SQL> select * from tb_recall_new ;

ID NAME ADDRESS A
---------- ------------------------------ --------------- ----------
1 surachart 999

SQL> update tb_recall_new set A=100;

1 row updated.

SQL> commit;

Commit complete.

SQL> !date
Thu Jun 3 16:17:46 ICT 2010

SQL> alter table tb_recall_new drop column A;

Table altered.

SQL> select * from tb_recall_new;

ID NAME ADDRESS
---------- ------------------------------ ---------------
1 surachart 999

SQL> select * from tb_recall_new as of timestamp to_timestamp ('2010-06-03:16:17:46', 'yyyy-mm-dd:hh24:mi:ss');

ID NAME ADDRESS A ZIP
---------- ------------------------------ --------------- ---------- ----------
1 surachart 999 100
then added old column name.
SQL> alter table tb_recall_new add (a number);

Table altered.

SQL> select * from tb_recall_new;

ID NAME ADDRESS A
---------- ------------------------------ --------------- ----------
1 surachart 999

SQL> select * from tb_recall_new as of timestamp to_timestamp ('2010-06-03:16:17:46', 'yyyy-mm-dd:hh24:mi:ss');

ID NAME ADDRESS A ZIP
---------- ------------------------------ --------------- ---------- ----------
1 surachart 999
After dropped and re- added column (old name), that made us don't see old data... Any Idea?

Some DDL statements cause error ORA-55610:
- ALTER TABLE statement that includes an UPGRADE TABLE clause, with or without an INCLUDING DATA clause
- ALTER TABLE statement that moves or exchanges a partition or subpartition operation
- DROP TABLE statement
SQL> drop table tb_recall_new;
drop table tb_recall_new
*
ERROR at line 1:
ORA-55610: Invalid DDL statement on history-tracked table
-)

Tuesday, June 01, 2010

Reset password Weblogic Console

Forgot password to login WebLogic Server Administrator Console, After installed Oracle EM 11g Grid.
* Authentication Denied

some steps to Fun ...
$ export DOMAIN_HOME=/u01/app/Oracle/gc_inst/user_projects/domains/GCDomain
$ cd $DOMAIN_HOME/bin
$ . setDomainEnv.sh
$ cd security/
$ mv DefaultAuthenticatorInit.ldift DefaultAuthenticatorInit.ldift_old
$ java weblogic.security.utils.AdminAccount weblogic password .
$ ls -l DefaultAuthenticatorInit.ldift
-rw-r--r-- 1 oracle oinstall 3301 Jun 1 18:46 DefaultAuthenticatorInit.ldift

$ cd ../servers/EMGC_ADMINSERVER/
$ mv data data_old
$ cd security/
$ mv boot.properties boot.properties_old
$ cd $DOMAIN_HOME
$ ./startWebLogic.sh
.
.
.
***************************************************
* To start WebLogic Server, use a username and *
* password assigned to an admin-level user. For *
* server administration, use the WebLogic Server *
* console at http://hostname:port/console *
***************************************************
starting weblogic with Java version:
java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed mode)
Starting WLS with line:
.
.
.
Enter username to boot WebLogic server:weblogic
Enter password to boot WebLogic server:password
.
.
.
<Jun 1, 2010 7:12:21 PM ICT> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
<Jun 1, 2010 7:12:33 PM ICT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY>
<Jun 1, 2010 7:12:33 PM ICT> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
Ctrl-C
check boot.properties file
$ ls ./servers/EMGC_ADMINSERVER/security/boot.properties
ls: ./servers/EMGC_ADMINSERVER/security/boot.properties: No such file or directory
then create boot.properties file
$ cat ./servers/EMGC_ADMINSERVER/security/boot.properties
username=weblogic
password=password
and then start WebLogic again.
$ ./startWebLogic.sh &
Checking
- check boot.properties file.
$ cat ./servers/EMGC_ADMINSERVER/security/boot.properties
password={AES}4R+5Tu48BpEKFH9zbrTxvbG5EZywMIpecpNxsV1+YAk\=
username={AES}OvsVXimdPC6X8TrgyzzjC9YT2Z+9I2o3KNvih8vHyWw\
- login WebLogic Server Administrator Console with new password

-)