Registry

[Oracle] Allowing Oracle ADI users to switch database with a batch file

Some ADI users will need to switch between database for different purposes. However, this would not be easy without having to change the network config files for Oracle.

I had created a batch file to allow users to change database by first preparing all the database registry, network config (tnsnames.ora and sqlnet.ora) and put them under C:\ADI. I had grant normal users the rights to change those files.

Below is the batch:

@ECHO off
cls
:start
ECHO.
ECHO ADI Menu.
ECHO 1. PRD 8000
ECHO 2. TST 8001
ECHO 3. UAT 8002
ECHO 4. DEV 8003
ECHO 5. PTH 8018
ECHO 6. Exit

set choice=
set /p choice=Please select database from the above list and press enter:
REM if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto PRD8000
if '%choice%'=='2' goto TST8001
if '%choice%'=='3' goto UAT8002
if '%choice%'=='4' goto DEV8003
if '%choice%'=='5' goto PTH8018
if '%choice%'=='6' goto Exit
REM set choice
ECHO "%choice%" is not a valid input, Please try again.
pause
ECHO.
cls
goto start

:PRD8000
ECHO PRD8000 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_Prod8000 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_Prod8000 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_Prod8000 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_Prod8000 tnsnames.ora

regedit /s c:\adi\prd8000.reg
goto end

:TST8001
ECHO TST8001 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_tst8001 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_tst8001 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_tst8001 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_tst8001 tnsnames.ora

regedit /s c:\adi\tst8001.reg
goto end

:UAT8002
ECHO UAT8002 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_uat8002 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_uat8002 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_uat8002 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_uat8002 tnsnames.ora

regedit /s c:\adi\uat8002.reg

goto end

:DEV8003
ECHO DEV8003 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_dev8003 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_dev8003 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_dev8003 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_dev8003 tnsnames.ora

regedit /s c:\adi\dev8003.reg
goto end

:PTH8018
ECHO PTH8018 selected.
del /q C:\orant\NET80\ADMIN\sqlnet.ora
del /q C:\orant\NET80\ADMIN\tnsnames.ora
del /q C:\orant\NETWORK\ADMIN\sqlnet.ora
del /q C:\orant\NETWORK\ADMIN\tnsnames.ora

copy C:\ADI\tnsnames.ora_pth8018 C:\orant\NETWORK\ADMIN\
copy C:\ADI\tnsnames.ora_pth8018 C:\orant\NET80\ADMIN\

ren C:\orant\NETWORK\ADMIN\tnsnames.ora_pth8018 tnsnames.ora
ren C:\orant\NET80\ADMIN\tnsnames.ora_pth8018 tnsnames.ora

regedit /s c:\adi\pth8018.reg
goto end

:Cancel
exit

:end
start C:\orant\BIN\GLDI9032.EXE

 

 

 

Advertisements

[Outlook] Search Results can’t be moved or Categorized and Categories column isn’t shown

When using Outlook 2016 with an Exchange account, setting flag or category on search result may not work. To fix the issue, please create and following key:

Key: HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Outlook\Options\Search
Value name: DisableServerAssistedSearch
Value type: REG_DWORD
Value: 1

More details can be found in this article.

Silent installation of Google Pinyin Chinese input

To install Google Pinyin silently, you can use the following parameter, no admin rights required:

GooglePinyinInstaller.exe -s

This is tested on version 2.7 on a Windows 7 machine, however,  it will not show in Programs and Features (Add/Remove program). To add an entry to it, you need the below registry:

 

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GooglePinyin2]
“DisplayName”=”谷歌拼音输入法 2.7”
“UninstallString”=”C:\\Program Files (x86)\\Google\\Google Pinyin 2\\GooglePinyinUninstaller.exe -s”
“DisplayIcon”=”C:\\Windows\\SysWOW64\\GooglePinyin2.ime”
“Publisher”=”Google Inc.”

 

Disable SCCM by removing registry

Below are the commands needed to remove the necessary registry to disable SCCM and enable Windows Update:

reg delete HKLM\Software\Policies\Microsoft\Windows\WindowsUpdate /f
net stop wuauserv
timeout 10
net start wuauserv