2014年12月29日 星期一

ORA-01720: grant option does not exist for 'PRODDTA.F4801'



    GRANT SELECT ON APAPS.V_X02 TO APCI;

oracle_DGTEST_testdb1$oerr ora 1720
01720, 00000, "grant option does not exist for '%s.%s'"
// *Cause:  A grant was being performed on a view and the grant option was
//          not present for an underlying object.
// *Action: Obtain the grant option on all underlying objects of the view.


參考
http://qwinn-aileen.blogspot.tw/2009/05/ora-01720-grant-option-does-not-exist.html


2014年11月10日 星期一

Cloud - CaaS and On premise 3 yeas TCO 比較 (不含網路設備,線路費用,機房基礎設施建構維護費用)



4,016,340 AT&T CaaS 3 year cost using below spec
1. 20 VM with CPU*2, Memory 4GB, 100GB storage
2. Data Transfer in/out 1GB
570,000 2P12C,144GB memory,600GB SAS disk *2
80,000 NAS 8TB
61,500 三年主機+存儲 電費
52,500 三年空調電費
764,000 On Premise 3 year cost using below spec
@ 20 VM * (CPU*2, Memory 4GB, 100GB storage)
@ 不包含網路設備,線路費用,機房基礎設施建構維護費用

2014年9月21日 星期日

Dropbox - cloud storage 用途

該想一下如何利用這xxTB的空間
1. File Server安裝dropbox,就不用做備份了,因為會直接同步到雲端,缺點是還原後windows ACL會跑掉。
2. 之前放在硬碟裡面的軟體installation files,好幾TB,就直接丟到dropbox去了,需要用的時候再開啟該目錄的同步。
3. 用來做跨國際的DR initial sync檔案傳送。

2014年9月12日 星期五

Virtualisation - Intel based CPU / ARM based CPU

在 Intel or ARM based computer 上面安裝hypervison,然後在其上安裝linux的source是否相同 ?
--> 如果是simulator, 使用linux 安裝光碟
--> 但是virtualization is not emulation, it work like a software partitioning of the existing resources,所以是用不同的光碟
--> 雖然intel based or ARM based 都是執行linux,但是其上的opensource application要重新編譯過,才能切換不同的平台使用

2014年9月3日 星期三

Oracle DB- Using the Oracle KEEP pool (Caching)




Oracle Automating Script for KEEP Pool Caching Tables & Indexes db_keep_cache_size
http://www.dba-oracle.com/t_script_automate_keep_pool_tables_indexes.htm

Using the Oracle KEEP pool
http://www.dba-oracle.com/oracle_tips_cache_small_fts.htm

Using the KEEP and RECYCLE Pool
http://www.toadworld.com/platforms/oracle/w/wiki/1347.using-the-keep-and-recycle-pool.aspx


Sometimes, data blocks are read in the database, and are infrequently reused. Often in a database we also have data blocks that are of frequent use (hot blocks). It is for these types of database blocks (and the objects associated with them) that Oracle offers the keep and recycle buffer pools. In this topic we will quickly review the database buffer cache, what the keep and recycle pools are, how to determine which objects to put in the keep pool, how to enable the buffer pool features, and finally how to assign objects to the buffer pools.

Buffer Cache Overview
Introducing the Keep and Recycle Pools
Analyze the Buffer Cache Usage
Enabling Multiple Buffer Pools
Dynamic Memory Allocation in Oracle9i
Guidelines for Initialization Parameters For Oracle8i
Allocating Segments to Different Pools

--Dell to Acquire Quest Software

2014年9月1日 星期一

Linux - Shell scripting, Show command executed along with output in log file



1. 用echo or printf

2. 用set -x


[root@testdb4 script]# tar cf /tmp/test.tar -T /root/script/tar_from.txt
tar: Removing leading `/' from member names
[root@testdb4 script]#
[root@testdb4 script]# /root/script/test_tar2.sh
[root@testdb4 script]#
[root@testdb4 script]# cat test_tar2.sh.out
+ tar cf /tmp/test.tar -T /root/script/tar_from.txt
tar: Removing leading `/' from member names
[root@testdb4 script]#
[root@testdb4 script]# cat /root/script/test_tar2.sh
#!/bin/sh
out=$0.out
set -x
{
tar cf /tmp/test.tar -T /root/script/tar_from.txt
} >$out 2>&1



[root@testdb4 script]# cat /root/script/test_tar2.sh
#!/bin/sh
out=$0.out
#set -x
{
tar cf /tmp/test.tar -T /root/script/tar_from.txt
} >$out 2>&1
[root@testdb4 script]# /root/script/test_tar2.sh
[root@testdb4 script]# cat test_tar2.sh.out
tar: Removing leading `/' from member names

  • 2>&1 indicates that the standard error (2>) is redirected to the same file descriptor that is pointed by standard output (&1).



2014年8月21日 星期四

Oracle DB - Use flashback database to recover the database to the point in time before failover. Physical Standby Database

1. 在DGTEST_S_US,Enable Flashback Database
2. 抄下DGTEST_P SCN  select to_char(current_scn) from v$database;   7316107016
3. 在DGTEST_P做一些交易,確認有被寫到DGTEST_S_US
4. 停止testdb1, testdb2, testdb3, make snapshot of testdb3
5. 開啟testdb3做測試
select OPEN_MODE, DB_UNIQUE_NAME, database_role, to_char(current_scn) from v$database;
READ ONLY WITH APPLY, DGTEST_S_US, PHYSICAL STANDBY, 7316107470

SQL> alter database activate physical standby database;
alter database activate physical standby database
*
ERROR at line 1:
ORA-10457: cannot close standby database due to active media recovery

SQL> recover managed standby database cancel; 

SQL> alter database activate physical standby database;

Database altered.

SQL> select OPEN_MODE, DB_UNIQUE_NAME, database_role, to_char(current_scn) from v$database;

OPEN_MODE
------------------------------------------------------------
DB_UNIQUE_NAME
--------------------------------------------------------------------------------
DATABASE_ROLE
------------------------------------------------
TO_CHAR(CURRENT_SCN)
--------------------------------------------------------------------------------
MOUNTED
DGTEST_S_US
PRIMARY
0

SQL> alter database open;


--測試

create table scott.emp_copy as select * from scott.emp;


--回復 standby db

6. 做FLASHBACK DATABASE 到Activate前的SCN

SQL> select to_char(current_scn) from v$database;

TO_CHAR(CURRENT_SCN)
--------------------------------------------------------------------------------
7316107953

SQL> select standby_became_primary_scn from v$database;

STANDBY_BECAME_PRIMARY_SCN
--------------------------
                7316107470
                
select to_char(standby_became_primary_scn) from v$database;

SQL> flashback database to scn 12841128892;
flashback database to scn 7316107470
*
ERROR at line 1:
ORA-38757: Database must be mounted and not open to FLASHBACK.


SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area  521936896 bytes
Fixed Size                  2214936 bytes
Variable Size             318768104 bytes
Database Buffers          192937984 bytes
Redo Buffers                8015872 bytes
Database mounted.
SQL> flashback database to scn 12841128892;

Flashback complete.

SQL> select to_char(current_scn) from v$database;

TO_CHAR(CURRENT_SCN)
--------------------------------------------------------------------------------
0

SQL> alter database convert to physical standby;

Database altered.

SQL> select OPEN_MODE, DB_UNIQUE_NAME, database_role, to_char(current_scn) from v$database;
select OPEN_MODE, DB_UNIQUE_NAME, database_role, to_char(current_scn) from v$database
                                                                           *
ERROR at line 1:
ORA-01507: database not mounted


SQL> shutdown immediate
ORA-01507: database not mounted


ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area  521936896 bytes
Fixed Size                  2214936 bytes
Variable Size             318768104 bytes
Database Buffers          192937984 bytes
Redo Buffers                8015872 bytes
Database mounted.
SQL> select OPEN_MODE, DB_UNIQUE_NAME, database_role, to_char(current_scn) from v$database;

OPEN_MODE
------------------------------------------------------------
DB_UNIQUE_NAME
--------------------------------------------------------------------------------
DATABASE_ROLE
------------------------------------------------
TO_CHAR(CURRENT_SCN)
--------------------------------------------------------------------------------
MOUNTED
DGTEST_S_US
PHYSICAL STANDBY
7316107470

SQL> alter database open;

Database altered.

SQL> select OPEN_MODE, DB_UNIQUE_NAME, database_role, to_char(current_scn) from v$database;

OPEN_MODE
------------------------------------------------------------
DB_UNIQUE_NAME
--------------------------------------------------------------------------------
DATABASE_ROLE
------------------------------------------------
TO_CHAR(CURRENT_SCN)
--------------------------------------------------------------------------------
READ ONLY
DGTEST_S_US
PHYSICAL STANDBY
7316107470

7. 開啟testdb1 and testdb2
8. 啟動 DGTEST_P and DGTEST_S
9. DGMGRL會自動帶起DETEST_S_US的 managed standby recovery.

Thu Aug 21 10:45:31 2014
Data Guard: Database open completed; restarting redo-apply ...
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE  THROUGH ALL SWITCHOVER DISCONNECT  USING CURRENT LOGFILE
Attempt to start background Managed Standby Recovery process (DGTEST)

SQL> select OPEN_MODE, DB_UNIQUE_NAME, database_role, to_char(current_scn) from v$database;

OPEN_MODE
------------------------------------------------------------
DB_UNIQUE_NAME
--------------------------------------------------------------------------------
DATABASE_ROLE
------------------------------------------------
TO_CHAR(CURRENT_SCN)
--------------------------------------------------------------------------------
READ ONLY WITH APPLY
DGTEST_S_US
PHYSICAL STANDBY
7316108323

SQL> create table scott.emp_copy2 as select * from scott.emp_copy;
SQL> select * from scott.emp_copy2;
SQL> alter system switch logfile;

10.用Data Guard Broker 再次確認

oracle_DGTEST_testdb1.rgp.raritan.com$dgmgrl
DGMGRL for Linux: Version 11.2.0.1.0 - 64bit Production

Copyright (c) 2000, 2009, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys
Password:
Connected.
DGMGRL> show configuration;

Configuration - DGTEST_P

  Protection Mode: MaxPerformance
  Databases:
    DGTEST_P    - Primary database
    DGTEST_S    - Physical standby database
    DGTEST_S_US - Physical standby database

Fast-Start Failover: DISABLED

Configuration Status:
SUCCESS