Friday, December 30, 2016

RMAN-20020: database incarnation not set

I have one PT env using storage sync for database sync.

Thought need to re-register DB after DB refresh, so unregister and register again.

RMAN> register database;
starting full resync of recovery catalog
full resync complete
database registered in recovery catalog
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03008: error while performing automatic resync of recovery catalog
RMAN-20020: database incarnation not set


However, this is the error.

Disconnected RMAN connection, and attempted to re- register , and finally succeed.

RMAN>   unregister database;



Do you really want to unregister the database (enter YES or NO)? yes
database unregistered from the recovery catalog

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
 full resync complete


Another way to overcome this , is to issue RESET DATABASE command, e.g in http://www.dbaref.com/home/rman/rman-20020databaseincarnationnotset

But I don't want to change DBID explicitly.




One more thought, in fact I don't need to unregister  & register again, as there is no change to DBID.



As such, what I need to do is just configure RMAN setting directly.


CONFIGURE DEFAULT DEVICE TYPE TO disk;
starting full resync of recovery catalog
full resync complete
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> #parallelism 2 for EE only
2> #CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO compressed backupset;
3>
4> #parallelism 1 for SE only
5> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO compressed backupset;
old RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> show all;
RMAN configuration parameters for database with db_unique_name PSCRMP are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/software/oraps/product/11.2.0/dbs/snapcf_PSCRMP.f'; # default

RMAN>
RMAN> #To ensure the control file is backed up by default, type the following at the RMAN prompt:
2> CONFIGURE CONTROLFILE AUTOBACKUP ON;
old RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
old RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters:
CONFIGURE BACKUP OPTIMIZATION ON;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>
RMAN> #To change how many backup sets you would like to retain, type the following at the RMAN prompt:
2> CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO disk;
old RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete



In the end, I even get back backupsets before refresh listed in catalog DB in few seconds.


RMAN> list backup summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time      #Pieces #Copies Compressed Tag
------- -- -- - ----------- -------------------- ------- ------- ---------- ---
10519659 B     U SBT_TAPE    2016-JUL-13 18:31:25 1       1       NO         DLPX2015052818345511D6F7437298
10519660 B     U SBT_TAPE    2016-JUL-13 18:32:35 1       1       NO         DLPX2015052818345511D6F7437298
10519661 B     U SBT_TAPE    2016-JUL-13 18:34:04 1       1       NO         DLPX2015052818345511D6F7437298
...
10520973 B  F  A DISK        2016-DEC-21 16:38:15 1       1       YES        TAG20161221T163047
10520974 B  F  A DISK        2016-DEC-21 16:47:00 1       1       YES        TAG20161221T163047
10520975 B  F  A DISK        2016-DEC-21 16:53:40 1       1       YES        TAG20161221T163047
10520976 B  F  A DISK        2016-DEC-21 16:58:26 1       1       YES        TAG20161221T163047
10520977 B  F  A DISK        2016-DEC-21 17:00:34 1       1       YES        TAG20161221T163047
10520978 B  F  A DISK        2016-DEC-21 17:03:35 1       1       YES        TAG20161221T163047
10520979 B  F  A DISK        2016-DEC-21 17:04:23 1       1       YES        TAG20161221T163047
10520980 B  F  A DISK        2016-DEC-21 17:05:07 1       1       YES        TAG20161221T163047
10520981 B  F  A DISK        2016-DEC-21 17:07:17 1       1       YES        TAG20161221T163047
10520982 B  F  A DISK        2016-DEC-21 17:09:28 1       1       YES        TAG20161221T163047
10520983 B  F  A DISK        2016-DEC-21 17:12:34 1       1       YES        TAG20161221T163047
10520984 B  F  A DISK        2016-DEC-21 17:13:47 1       1       YES        TAG20161221T163047
10520985 B  F  A DISK        2016-DEC-21 17:14:44 1       1       YES        TAG20161221T163047
10520986 B  F  A DISK        2016-DEC-21 17:15:01 1       1       YES        TAG20161221T163047
10520987 B  F  A DISK        2016-DEC-21 17:15:33 1       1       YES        TAG20161221T163047
10520988 B  F  A DISK        2016-DEC-21 17:15:50 1       1       YES        TAG20161221T163047
10520989 B  F  A DISK        2016-DEC-21 17:16:47 1       1       YES        TAG20161221T163047
10520990 B  F  A DISK        2016-DEC-21 17:18:01 1       1       YES        TAG20161221T163047
10520991 B  F  A DISK        2016-DEC-21 17:18:26 1       1       YES        TAG20161221T163047
10520992 B  F  A DISK        2016-DEC-21 17:20:53 1       1       YES        TAG20161221T163047
10520993 B  F  A DISK        2016-DEC-21 17:22:16 1       1       YES        TAG20161221T163047
10520994 B  F  A DISK        2016-DEC-21 17:23:05 1       1       YES        TAG20161221T163047
10520995 B  F  A DISK        2016-DEC-21 17:24:21 1       1       YES        TAG20161221T163047
10520996 B  F  A DISK        2016-DEC-21 17:25:24 1       1       YES        TAG20161221T163047
10520997 B  F  A DISK        2016-DEC-21 17:26:13 1       1       YES        TAG20161221T163047
10520998 B  F  A DISK        2016-DEC-21 17:27:57 1       1       YES        TAG20161221T163047
10520999 B  F  A DISK        2016-DEC-21 17:28:30 1       1       YES        TAG20161221T163047
10521000 B  F  A DISK        2016-DEC-21 17:29:31 1       1       YES        TAG20161221T163047
10521092 B  F  A DISK        2016-DEC-21 17:29:34 1       1       NO         TAG20161221T172934
10568384 B  F  A DISK        2016-DEC-22 12:41:04 1       1       NO         TAG20161222T124104
10568391 B  F  A DISK        2016-DEC-22 11:42:06 1       1       YES        TAG20161222T114206
10568401 B  F  A DISK        2016-DEC-22 11:49:41 1       1       YES        TAG20161222T114206
10568413 B  F  A DISK        2016-DEC-22 11:58:26 1       1       YES        TAG20161222T114206
10568426 B  F  A DISK        2016-DEC-22 12:05:12 1       1       YES        TAG20161222T114206
10568440 B  F  A DISK        2016-DEC-22 12:09:57 1       1       YES        TAG20161222T114206
10568455 B  F  A DISK        2016-DEC-22 12:12:02 1       1       YES        TAG20161222T114206
10568471 B  F  A DISK        2016-DEC-22 12:14:57 1       1       YES        TAG20161222T114206
10568488 B  F  A DISK        2016-DEC-22 12:15:43 1       1       YES        TAG20161222T114206
10568506 B  F  A DISK        2016-DEC-22 12:16:28 1       1       YES        TAG20161222T114206
10568525 B  F  A DISK        2016-DEC-22 12:18:43 1       1       YES        TAG20161222T114206
10568545 B  F  A DISK        2016-DEC-22 12:20:48 1       1       YES        TAG20161222T114206
10568566 B  F  A DISK        2016-DEC-22 12:23:54 1       1       YES        TAG20161222T114206
10568588 B  F  A DISK        2016-DEC-22 12:25:09 1       1       YES        TAG20161222T114206
10568611 B  F  A DISK        2016-DEC-22 12:26:14 1       1       YES        TAG20161222T114206
10568635 B  F  A DISK        2016-DEC-22 12:26:39 1       1       YES        TAG20161222T114206
10568660 B  F  A DISK        2016-DEC-22 12:27:04 1       1       YES        TAG20161222T114206
10568686 B  F  A DISK        2016-DEC-22 12:27:20 1       1       YES        TAG20161222T114206
10568713 B  F  A DISK        2016-DEC-22 12:28:25 1       1       YES        TAG20161222T114206
10568741 B  F  A DISK        2016-DEC-22 12:29:40 1       1       YES        TAG20161222T114206
10568770 B  F  A DISK        2016-DEC-22 12:30:05 1       1       YES        TAG20161222T114206
10568800 B  F  A DISK        2016-DEC-22 12:32:30 1       1       YES        TAG20161222T114206
10568831 B  F  A DISK        2016-DEC-22 12:33:56 1       1       YES        TAG20161222T114206
10568863 B  F  A DISK        2016-DEC-22 12:34:41 1       1       YES        TAG20161222T114206
10568896 B  F  A DISK        2016-DEC-22 12:35:56 1       1       YES        TAG20161222T114206
10568930 B  F  A DISK        2016-DEC-22 12:37:01 1       1       YES        TAG20161222T114206
10568965 B  F  A DISK        2016-DEC-22 12:37:47 1       1       YES        TAG20161222T114206
10569001 B  F  A DISK        2016-DEC-22 12:39:32 1       1       YES        TAG20161222T114206
10569038 B  F  A DISK        2016-DEC-22 12:40:07 1       1       YES        TAG20161222T114206



Wednesday, November 30, 2016

database link between Vertica/non-Vertica database

Summarize some research about database link  between Vertica/non-Vertica database


As of now, DB links feature in not present in Vertica. We can not create Vertica database links like those that exist in Oracle and SQL Server. Moreover, we cannot run two databases simultaneously at one time in Vertica cluster.

But we can easily connect to another Vertica database if we need to to copy data between two Vertica databases. See the SQL Reference Manual:
CONNECT TO VERTICA database USER username PASSWORD 'password' ON 'host',port

For copy ORACLE data to Vertica, once can uses a unix shell script. Use COPY command in Vertica. In a shell script, pipe the output from oracle to Vertica in COPY command ( using input as STDIN) and then run the script. This shell script can also be used as STORED PROC in Vertica and running this Stored Proc from Vertica will pull the data from Oracle to Vertica.

For table join, if it requires join two tables in two Vertica databases, why not use two different schemas in same cluster/database  which can act as two different database.

Create Linkserver from SQL Server to Vertica via ODBC is possible, however there can have  performance concern.

Thursday, November 24, 2016

install 32bit instantclient ODBC for 64bit windows 2008 R2

One of my developer encountered similar issue in this nice article .

His creates Visual Basic form in MS Office Excel to pull data from Oracle database, while the Excel is 32 bits installed in his 64 bits windows 7 , hence requires 32 bits ODBC for this to work.















Launch 32bit ODBC configuration program (ODBC Data Source ) C:\Windows\SysWOW64, we can see there is "Microsoft ODBC for Oracle".  This is the same finding for his target depLoying server (windows 2008R2).  I was thinking no more 32bits  "Microsoft ODBC for Oracle" in windows 2008, which is wrong.


The server has 64 bits oracle client already installed for other application,

Luckily  I notice there is 32bit ODBC for 11g instantclient.  This is help to minimize the impact.


Follow the instantclient ODBC installation guide :
1. run odbc_install.exe as administrator in command prompt.
2. Append path of instantclient (e:\instantclient11203) to system environment variable PATH
3. create tnsnames.ora in e:\instantclient11203\netwoork\admin\

Missing part of the guide is : Launch 32bit ODBC configuration program (ODBC Data Source ) C:\Windows\SysWOW64\odbcad32.exe,

After this, my developer told me that his program can run suddenly.






Reference:

MS ODBC for Oracle

Oracle ODBC Centre

Friday, September 30, 2016

SQL Server 2000 audit

There might be a requirement to audit failure logins.

sp_readerrorlog works in charm for version 2005 and above, however it is not in sql server 2000.

As it has different format for parameters. After spent some time, I finally find out how to use it correctly.
eg.

 Exec sp_readerrorlog 1,'D:\test.txt' ,  'world'   # grep all lines having the word

 Exec sp_readerrorlog 1,'D:\test.txt' , 3  # read 3rd line

 Exec sp_readerrorlog 1,'D:\mediator_dev\MSSQL$MED\LOG\ERRORLOG','Backup'



from
http://www.databasejournal.com/features/mssql/article.php/3399241/SQL-Server-2000-Security---Part-10---Auditing.htm

Login auditing - four option buttons - None, Success, Failure and All - under the "Audit level" heading on the Security tab of the SQL Server Properties dialog box in SQL Server Enterprise Manager control level of SQL Server login audits. These choices correspond to values of 0, 1, 2 and 3 in the AuditLevel entry in the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQLServer\ registry key AuditLevel of DWORD data type. This value determines whether login attempts with specified outcome (or any at all) will be recorded in the Windows Application Event Log and SQL Server error log.

It seems by default audit level is 0.



References:

http://vyaskn.tripod.com/sp_readerrorlog_undocumented.htm


Wednesday, September 14, 2016

install nerdtree with vbundle for vim

1. preparation

    touch ~/.vimrc
    mkdir~/.vim/bundle

2. install vbundle

git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
 

3. add the following to .vimrc

set nocompatible               " be iMproved
filetype off                   " required!

set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

" let Vundle manage Vundle
" required! 
Bundle 'gmarik/vundle'

" My Bundles here:

filetype plugin indent on     " required!
"
" Brief help
" :BundleList          - list configured bundles
" :BundleInstall(!)    - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!)      - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed.. 
 
 

4. install NERDTree, add the bundle name to .vimrc


call vundle#begin()

     
Bundle 'scrooloose/nerdtree'

call vundle#end()  



 5. re-launch vi, and type the :BundleInstall command to install the nerdtree.


6.  verify able to launch nerdtree, by typing ":NERDTree" . Note that the command is sensitive.

7. create hotkey  F2 for NERDTRee:  add below line to .vimrc.

 
 

 
some commands I learned easilly:
 
ctr+w+h  光标移到左侧树形目录,
ctrl+w+l 光标移到右侧文件显示窗口
ctrl + w + w    光标自动在左右侧窗口切换
 
   o 打开关闭文件或者目录

   t 在标签页中打开

  T 在后台标签页中打开

  ! 执行此文件

  p 到上层目录

  P 到根目录

  K 到第一个节点

  J 到最后一个节点
 k  previous
j  next 
  

tabs commands are what I am thinking to google,but already there.

:tabnew [++opt选项] [+cmd] 文件      建立对指定文件新的tab
:tabc   关闭当前的 tab
:tabo   关闭所有其他的 tab
:tabs   查看所有打开的 tab
:tabp   前一个 tab
:tabn   后一个 tab
 
 
 
and more to practice noted below.


ctrl + w + r    移动当前窗口的布局位置
go      在已有窗口 中打开文件、目录或书签,但不跳到该窗口
i       split 一个新窗口打开选中文件,并跳到该窗口
gi      split 一个新窗口打开选中文件,但不跳到该窗口
s       vsplit 一个新窗口打开选中文件,并跳到该窗口
gs      vsplit 一个新 窗口打开选中文件,但不跳到该窗口
!       执行当前文件
O       递归打开选中 结点下的所有目录
x       合拢选中结点的父目录
X       递归 合拢选中结点下的所有目录
e       Edit the current dif
双击    相当于 NERDTree-o
中键    对文件相当于 NERDTree-i,对目录相当于 NERDTree-e
D       删除当前书签
C       将选中目录或选中文件的父目录设为根结点
u       将当前根结点的父目录设为根目录,并变成合拢原根结点
U       将当前根结点的父目录设为根目录,但保持展开原根结点
r       递归刷新选中目录
R       递归刷新根结点
m       显示文件系统菜单
cd      将 CWD 设为选中目录
I       切换是否显示隐藏文件
f       切换是否使用文件过滤器
F       切换是否显示文件
B       切换是否显示书签
 

also reviewed commands to execute external commands.

:shell or just :sh  or Ctrl-z  and fg


:r textfile
:r ! ls -1 /home/user/directory


Installation on cygwin

Followed this article, I easily installed NERDTree  to the vim.

https://my.oschina.net/VASKS/blog/388907


Installed more bundle from  http://www.zlovezl.cn/articles/vim-plugins-cannot-live-without/


In short time, I built up my own .vimrc as shown below.

hmc@hmc-P55A-UD3:~$ cat .vimrc
syntax enable
syntax on
set nocompatible              " be iMproved, required
filetype off                  " required

set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

   
Bundle 'scrooloose/nerdtree'
Bundle 'jistr/vim-nerdtree-tabs'
Bundle 'scrooloose/syntastic'
Bundle 'Valloric/YouCompleteMe'
Bundle 'vim-airline/vim-airline'
Bundle 'chriskempson/base16-vim'
Bundle 'majutsushi/tagbar'

call vundle#end()            " required
filetype plugin indent on    " required

nmap :NERDTreeToggle
let g:nerdtree_tabs_open_on_console_startup=1
map n NERDTreeTabsToggle


" for YCM

" 设置跳转到方法/函数定义的快捷键
 nnoremap j :YcmCompleter GoToDefinitionElseDeclaration
 " 触发补全快捷键
let g:ycm_key_list_select_completion = ['', '', '']
let g:ycm_key_list_previous_completion = ['', '', '']
let g:ycm_auto_trigger = 1
" 最小自动触发补全的字符大小设置为 3
let g:ycm_min_num_of_chars_for_completion = 3
" YCM的previw窗口比较恼人,还是关闭比较好
set completeopt-=preview




References:



http://williamherry.com/blog/2012/07/16/master-vim-01-vundle/
http://williamherry.com/blog/2012/07/19/master-vim-02-nerdtree/

https://my.oschina.net/VASKS/blog/388907
https://www.linux.com/learn/vim-tips-working-external-commands
http://os.51cto.com/art/201507/484174.htm

http://blog.csdn.net/namecyf/article/details/7787479

Wednesday, September 07, 2016

cut and paste for vi

--For Solaris, AIX , HP-UX platform

shift + v    # for copy to clipboard
dd             # delete the line
p               # paste



--For Linux platform

shift + v
d            # delete the line, slightly different with Solaris
p


Ref: http://stackoverflow.com/questions/8773299/how-to-cut-an-entire-line-in-vim-and-paste-it

Monday, August 29, 2016

laztoapk demo compliation error: cannot find crtbegin_so.o

with the help of laztoapk v0.9.0.35, which speeds up the setup in windows platform.

However, I hit below error when complile the example project.

D:\laztoapk\downloads\laz4android\fpc\3.0.0\bin\i386-win32\arm-linux-androideabi-ld.bfd.exe: cannot find crtbegin_so.o


after reading http://wiki.freepascal.org/Android_tutorial#Compile_the_demo_.22androidlcl.22  

I notice the library path in default value of "project option/compilation option/path / library " is not correct, where it is
D:\android-ndk-r10e\platforms\android-8\arch-arm\usr\lib\;D:\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.9\

they are not my actual path,  Missing the "prefix" path  -   "D:\laztoapk\downloads"  for my environment.

Corrected them as shown below, and recompilation succeed!


D:\laztoapk\downloads\android-ndk-r10e\platforms\android-8\arch-arm\usr\lib\;D:\laztoapk\downloads\android-ndk-r10e\toolchains\arm-linux-androideabi-4.9\prebuilt\windows\lib\gcc\arm-linux-androideabi\4.9\


 and I contributed the answer to http://forum.lazarus.freepascal.org/index.php/topic,22414.30.html


Hope this help the author if this is a bug.