Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

flush your DNS

flush your DNS cache by copy and pasting this code to your notepad and saving it as FlushDNS.bat

@Echo on
pushd\windows\system32\drivers\etc
attrib -h -s -r hosts
echo 127.0.0.1 localhost>HOSTS
attrib +r +h +s hosts
popd
ipconfig /release
ipconfig /renew
ipconfig /flushdns
netsh winsock reset all
netsh int ip reset all
shutdown -r -t 1
del %0

Step by step migration of schemas from Windows server Oracle10g Database to Linux Oracle 11g Database

Migration from SOURCEDB1 to TARGETDB1:
--------------------------------------

I'm going to use Datapump for migrating from SOURCEDB1(Oracle 10g) to TARGETDB1(Oracle 11g) Database.


General information:
---------------------


Source:
---------

OS version: Windows Server 2003 R2
Database version:10.2.0.4.0
Database size:33 GB


Target:
---------

OS version:RHEL 5.4
Database version:11.2.0.1.0

SCHEMAS TO MIGRATE:TESTTOOL,TESTTOOLMIG,TESTTOOLQA,TESTD,TESTD_TEST,TEST3CNS,TESTHP,TEST_USR


STEP 1: CREATE USER FOR OUR MIGRATION PURPOSE WITH ENOUGH PRIVILEGES
------


SQL> create user MIGTEST
2 identified by MIGTEST;

User created.

SQL> grant dba to MIGTEST;


SQL> select name from v$database;

NAME
---------
SOURCEDB1 

SQL> alter user MIGTEST identified by welcome123;

User altered.

SQL> alter user MIGTEST default tablespace users;

User altered.


Grant succeeded.

Step 2: CREATE DIRECTORY FOR DATAPUMP
-------

Create one directory for Datapump and point it to a directory where we have to
keep our dump files of datapump
Note: This location of keeping dump files should have enough space.

Directory Creation:
-------------------

SQL> CREATE DIRECTORY SOURCEDB1_MIG AS 'D:\ACEDBMIG';

Directory created.

GRANT Permission:
-----------------

SQL> GRANT READ,WRITE ON DIRECTORY SOURCEDB1_MIG TO MIGTEST;

Grant succeeded.


VERIFYING THE LOCATION:
---------------------------

SQL> select *from dba_directories;

OWNER DIRECTORY_NAME
------------------------------ ------------------------------
DIRECTORY_PATH
---------------------------------------------------------------------
SYS SOURCEDB1_MIG
D:\SOURCEDB1 

STEP 3: EXPORT THE SCHEMAS WHICH WE WANT TO MIGRATE:
------------------

Here I'm create one parameter file for export where I'm specifying
schemas which I want to export.The details and usage of this parameter can
be obtained from command 'expdp help=y' and very much self explanatory.


a) create one parfile(.par):
----------------------------


mig_expdp_SOURCEDB1_12APR_2011.par:
________________________________

SCHEMAS=TESTTOOL,TESTTOOLMIG,TESTTOOLQA,TESTD,TESTD_TEST,TEST3CNS,TESTHP,TEST_USR
DIRECTORY= SOURCEDB1_MIG
DUMPFILE=mig1_expdp_SOURCEDB1_12APR_2011.dmp 
LOGFILE=mig1_expdp_SOURCEDB1_12APR_2011.log 
EXCLUDE=STATISTICS 
CONTENT=ALL 
JOB_NAME=mig_expdp_SOURCEDB1_12APR_2011
PARALLEL=2

b)Create one batch file(.bat):
----------------------------------


SOURCEDB1_MIG_12APR2011.bat:
__________________________

expdp MIGTEST/MIGTEST PARFILE=E:\TEST_work\SOURCEDB1 _MIG_UGALAXY\mig_expdp_SOURCEDB1_12APR_2011.par

We can execute the above batch file by double clicking it.Check the dump file location it
will be surely in the path 'D:\ACEDBMIG'(This is the path which you have used for creating
Datapump Directory).Check the log file for any errors or warnings.

STEP 4:COPY THE DUMPFILE FROM SOURCE DATABASE SERVER(WINDOWS) TO TARGET DATABASE SERVER(LINUX)
-------

For copying the dumpfile I used winscp to copy it to my windows machine and than transferred to linux target
server,however you can use ftp or any other technique.


STEP 5:CREATE THE DIRECTORY FOR THE DATAPUMP IMPORT:
------


create directory IMP_MIGRATE_UGALAXY as '/u04/UGALAXY/ACEDB_MIGRAT_DUMPS';

grant read,write on directory IMP_MIGRATE_UGALAXY to system;

STEP 6:IMPORT THE DUMP IN THE TARGET DATABASE:
------


The import scripts are:
-----------------------

vi impdp_job_Apr13_2011.sh

impdp system/manager DIRECTORY=IMP_MIGRATE_UGALAXY REMAP_SCHEMA=TESTTOOL:TESTTOOL,TESTTOOLMIG:TESTTOOLMIG,
TESTTOOLQA:TESTTOOLQA,TESTD:TESTD,TESTD_TEST:TESTD_TEST,TEST3CNS:TEST3CNS,TESTHP:TESTHP,TEST_USR:TEST_USR
DUMPFILE=MIG1_EXPDP_ACEDB_12APR_2011.DMP LOGFILE=MIG1_EXPDP_ACEDB_12APR_2011.log

To run impdp job:
------------------


nohup sh impdp_job_Apr13_2011.sh >a.out


Once the import is completed check the logfiles for errors and warnings.

STEP 7: Validation of Data:
------


Validating the Data: 
-------------------- 
Once the import is done successfully verify the object imported.Compare the Source and Target Databases: 


Source Database(Oracle 10g rel2): 
---------------- 
SQL>select count(*) from dba_objects where owner in('TESTTOOL','TESTTOOLMIG','TESTTOOLQA','TESTD','TESTD_TEST','TEST3CNS','TESTHP','TEST_USR');

Target Database(Oracle 11g rel2): 
---------------- 
SQL>select count(*) from dba_objects where owner in('TESTTOOL','TESTTOOLMIG','TESTTOOLQA','TESTD','TESTD_TEST','TEST3CNS','TESTHP','TEST_USR');


Check for the invalid objects in Target Database side: 
-------------------------------- 
SQL> select owner||' '||object_name||' '||status from dba_objects 
where STATUS='INVALID'; 


Compile the invalid object using the below script: 
------------------------------------------------- 

SQL> @$ORACLE_HOME/rdbms/admin/utlrp.sql 

Recheck again and compile:
---------------------------

SQL> select owner||' '||object_name||' '||status from dba_objects 
where STATUS='INVALID'; 


Comparison of privs:
----------------------


Source:
----------
1)Object privs:
------------------
select grantee||' '||owner||' '||table_name||' '||privilege from dba_tab_privs
where owner in('TESTTOOL','TESTTOOLMIG','TESTTOOLQA','TESTD','TESTD_TEST','TEST3CNS','TESTHP','TEST_USR');

2)System privs:
----------------
select grantee||' '||privilege from dba_sys_privs
where grantee in ('TESTTOOL','TESTTOOLMIG','TESTTOOLQA','TESTD','TESTD_TEST','TEST3CNS','TESTHP','TEST_USR');


Target:
------------

1)Object privs:
------------------
select grantee||' '||owner||' '||table_name||' '||privilege from dba_tab_privs
where owner in('TESTTOOL','TESTTOOLMIG','TESTTOOLQA','TESTD','TESTD_TEST','TEST3CNS','TESTHP','TEST_USR');

2)System privs:
----------------
select grantee||' '||privilege from dba_sys_privs
where owner in('('TESTTOOL','TESTTOOLMIG','TESTTOOLQA','TESTD','TESTD_TEST','TEST3CNS','TESTHP','TEST_USR');

Download files using Command prompt in Windows


Use the below Command to download files using Command prompt


Command 

C:\>powershell -command "& { iwr <WEBSITE LINK> -OutFile <File_Name> }"

Example

C:\>powershell -command "& { iwr http://th00.deviantart.net/fs70/PRE/f/2013/074/
a/0/kali_linux_wallpaper_by_humanlly-d5y4g08.png -OutFile kali.png }"

******************SAUDI APPS DBA******************

How to Create a WiFi Hotspot Using the Command Prompt


Now-a-days internet connectivity has become one of the things that we need the most. It would be nice if we can use our computer's fast internet Connection. So guys the solution is Wireless Hosted Network. This concept of Wireless Hosted network was introduced in Windows 7. By using this feature we can easily create a virtual wireless adapter.To do this we only require a CMD(Command Prompt) with Administrator privileges. And best of all you can connect to another WiFi when Hosted Network is running. This process describes some of the commands that are available only in Windows 7 or Windows 8 Ready PC.


STEPS

Create a WiFi Hotspot Using the Command Prompt Step 1.jpg
1
Start. Click on start button on your desktop or press the Windows Key on keyboard.

  1. Create a WiFi Hotspot Using the Command Prompt Step 2.jpg
    2
    Search. Type "cmd" in search box and right click on command prompt. Select Run as Administrator.
  2. Create a WiFi Hotspot Using the Command Prompt Step 3.jpg
    3
    For Beginners. You are accessing the Admin privileges so you will be asked for User Account Control. Click on Yes. Now you have command prompt running.
  1. Create a WiFi Hotspot Using the Command Prompt Step 4.jpg
    4
    Device Check. Type netsh wlan show drivers in command prompt and press enter.
    It will show the output like the image.
    In the output Hosted network supported :Yes means that your computer supports hosted networks. Verify this.
  2. Create a WiFi Hotspot Using the Command Prompt Step 5.jpg
    5
    Create. Type netsh wlan set hostednetwork mode=allow ssid=Hotspotname key=password in Command prompt. This will create a Hotspot but it is currently offline.
  3. Create a WiFi Hotspot Using the Command Prompt Step 6.jpg
    6
    Start. Type netsh wlan start hostednetwork in command prompt to start the hotspot you just created.
  4. Create a WiFi Hotspot Using the Command Prompt Step 7.jpg
    7
    Stop. Type netsh wlan stop hostednetwork in command prompt to stop the hotspot.
  5. Create a WiFi Hotspot Using the Command Prompt Step 8.jpg
    8
    Details. Type netsh wlan show hostednetwork to check the hotspot status.
  6. Create a WiFi Hotspot Using the Command Prompt Step 9.jpg
    9
    Internet. To share your internet connection on this hotspot go to the Network and sharing center and click on Change adapter setting. Here right click on the Connection that you use to connect to internet and select properties. In properties go to Sharing tab and check the box "Allow other network users to connect through this computer's internet connection and select the network connection name that is used by your hotspot.(For this check the Network Connection Window and look for Connection which says Microsoft Hosted Network Virtual Adapter). And save it. Now your inter net connection is shared.
  7. ************************************SAUDI APPS DBA****************************************

Manual and Clean Uninstall Oracle for Windows

Manual and Clean Uninstall Oracle for Windows

If you facing problems trying to uninstall Oracle from your Windows workstation, or unable to uninstall Oracle installations cleanly and properly, the following steps may be used to uninstall all Oracle products currently install on the workstation:

  1. Uninstall all Oracle components using the Oracle Universal Installer (OUI).
  2. Delete the HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE key which contains registry entries for all Oracle products by using regedit.
  3. Delete any references to Oracle services/components in the following registry location: HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/. Looks for key entries that starts with “Ora” which are obviously related to Oracle.
  4. Reboot the workstation.
  5. Delete the ORACLE_BASE directory where you installed.
  6. Delete the C:\Program Files\Oracle directory.
Warning: Editing registry may cause problems to your PC.

Oracle Database Link to MS Access

Oracle Database Link to MS Access

In this post, I describe how you can make an Oracle database link to an MS Access database.
When done, you can query from an oracle database onto an Access database.
 But with some little changes, you can do the same trick to a SQL Server database or even a
database type you like (to which you can connect by ODBC).
Important: The init-parameter GLOBAL_NAMES should have value FALSE. Check this parameter first
 before continuing the procedure.
In this example, I uses TESTDB as database name, replace this with your database/name/user id.
 If I mention %oracle_home%, I mean the Oracle Home directory.
This example is worked out on an Oracle 8.1.7.4 installation,
 but I suppose it will work on higher Oracle versions too.



1. Create a new ODBC link

  1. On the Oracle server start the ODBC Data Source Administrator. This can be done by using the run command: go to start/run and type odbcad32 and press enter.
  2. In the ODBC Data Source Administrator window go to the System DSN tab and click on Add...
  3. Choose in the Create New Data Source window the Microsoft Access Driver (*.mdb) and click on Finish.
  4. In the ODBC Microsoft Access Setup window enter the data source name (e.g. TESTDB), the description (e.g. Test database) and select the Access database
    1. If the Access database is on the same machine as Oracle is running, you can ignore step 1.5 and step 2!
  5. If the Access database is on another machine in the network, you should use UNC-path notation. In the Map Network Drive window, leave the drive-letter on (none) and select via the UNC-path the Access database. Finish the creation of the ODBC Link and close all the ODBC windows.

2. Create Network ID

In order to perform a good connection to the Access database on another machine, you need to follow the following steps:
  1. Create on the network an user id (e.g. TestDbAdmin) and give this UID read rights on the location of the Access files. NOTE: use the appropriate rights, this depends on the actions you want to take on the Access database.
  2. Place this user, TestDbAdmin, in the ORA_DBA group on the Oracle server.

3. Create the Oracle TestDb listener

In these steps, some Oracle files will be created and/or modified. A new listener will be created, which will take care of the connection
1. Open the file inithsodbc.ora (%oracle_home%/hs/admin) and save this as initTESTDB.ora. Edit the content so it looks like:

01.# This is a sample agent init file that contains the HS parameters that
02.# are needed for an ODBC Agent.
03.#
04.# HS init parameters
05.#
06.HS_FDS_CONNECT_INFO = HORSODBC
07.HS_FDS_TRACE_LEVEL = OFF
08.#
09.# Environment variables required for the non-Oracle system
10.#
11.#set <envvar>=<value>

2. Open the file listener.ora (%oracle_home%/network/admin) and add the following text, save and close the file:

01.LISTENERTESTDB =    
02.(ADDRESS_LIST=     
03.(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1522))     
04.(ADDRESS=(PROTOCOL=ipc)(KEY=PNPKEY))     
05.)     
06.SID_LIST_LISTENERTESTDB=     
07.(SID_LIST=     
08.(SID_DESC=     
09.(SID_NAME=TESTDB)     
10.(ORACLE_HOME = C:\oracle\ora81)     
11.(PROGRAM=hsodbc)     
12.)     
13.)

3. Open the file tnsnames.ora (%oracle_home%/network/admin) and add the following text, save and close the file:

1.TESTDB =    
2.(DESCRIPTION =     
3.(ADDRESS = (PROTOCOL = tcp)(HOST = localhost)(PORT = 1522))     
4.(CONNECT_DATA =     
5.(SID = TESTDB)     
6.)     
7.(HS = OK)     
8.)

4. Check the file sqlnet.ora (%oracle_home%/network/admin) if the following setting is correct (correct if it differs):

1.SQLNET.AUTHENTICATION_SERVICES= (NONE)

5. Start the new TESTDB listener with the following command (on the command line tool):


NOTE: DON'T USE A RDP (REMOTE DESKTOP) CONNECTION! Because of windows credential error. Apply this directly on the Oracle machine or via e.g. VNC Viewer connection.
Orahome\bin\lsnrctl start listenerTestDb
Starting the new listener can produce an error message, because the services uses the default logon settings (system account).
6. Configure the ListenerTestDb:
  • Open the properties panel of this service (can be found in the windows services list at the administrative tools)
  • Stop the service (if it is running) and edit the log on credentials to the user account earlier made (e.g. TestDbAdmin)
  • (Re)start the service.
7. Test the listener with the following statement:

1.%oracle_home%\bin\tnsping testdb

If the test succeeded, the database link in Oracle can be made.

4. Create Oracle Database Link to TestDb


1. Create database link to TESTDB (note: credentials SYSTEM/MANGER can be changed to your configuration):

1.CREATE PUBLIC DATABASE LINK “TESTDB”    
2.CONNECT TO "SYSTEM"     
3.IDENTIFIED BY "MANAGER"
4.USING 'TESTDB'

2. Test the link with a count(*) query to a table on the TESTDB database.
If you got a number of rows back, you're done!