Saturday, September 19, 2015

Oracle Linux and RHEL command history tips

14.8. Tips on Using Command History

What are some other ways I can use command history?
If you type history, a numbered list scrolls by very quickly, showing you the previous 500 commands you have used.
You probably do not need to see all of the last 500 commands, so the command history 20 might be useful. This way, only the previous 20 commands you typed are displayed (you can use any quantity as an argument of the history command).

14.8.1. Other Shortcuts

Here are other command history shortcuts which may be useful to you:
  • "Bang, bang": Typing !! (called "bang bang") executes the last command in the history.
  • "Bang number": Typing !number (as in !302) executes the command which is numbered 302 in the history file.
  • "Bang string": Typing !string (as in !rpm) executes a command with the most recent matching string from the history file.
  • [Up arrow] and [down arrow]: At the shell or GUI terminal prompt, you can press the up arrow to move back through previous commands in your history list (the down arrow moves you forward through the commands) until you find the command you want. Press [Enter] to execute the command, just as if you had typed it on the command line.

Friday, February 13, 2015

Can I add a DB Link to Oracle that connects to MS SQLSERVER?

Source : Oracle 11g on linux
destination : ms sql server 2005

i need to create the db link from oracle to ms sql server to view the tables , is it posibble without configuring the gateways( as looks like it is licenced product)

Please let me know any alternative to achive this

Thanks
PGR
kgronau
Correct Answerby kgronau on Nov 12, 2013 10:00 AM
There are 2 gateway - the commercial Database Gateway for Ms SQl Server which requires a license and the Database Gateway for ODBC which is for free. The license for DG4ODBC is included in your database license. You only need to install a suitable ODBC driver on your Linux box (for example use the MS SQl Server ODBC driver for Linux - details can be found here: http://www.microsoft.com/en-gb/download/details.aspx?id=36437 ). and then configure the gateway using the My Oracle Support Note:
How to Configure DG4ODBC on 64bit Unix OS (Linux, Solaris, AIX, HP-UX Itanium) to Connect to Non-Oracle Databases Post Install  [Article ID 561033.1]


- Klaus

Adding MS ODBC driver to Linux

http://www.microsoft.com/en-gb/download/details.aspx?id=36437

So you can add a link to a MS SQLSRVR from an Oracle running on Linux.


Microsoft® ODBC Driver 11 for SQL Server® - RedHat Linux

Language:
English
The Microsoft ODBC Driver For SQL Server provides native connectivity from Windows to Microsoft SQL Server and Windows Azure SQL Database.
  • Details
    Note:There are multiple files available for this download.Once you click on the "Download" button, you will be prompted to select the files you need.
    Version:
    11.0.2270.0
    File Name:
    RedHat6\msodbcsql-11.0.2270.0.tar.gz
    RedHat5\msodbcsql-11.0.2270.0.tar.gz
    RedHat5\msodbcsql-11.0.2270.0.tar.gz.sha256
    RedHat6\msodbcsql-11.0.2270.0.tar.gz.sha256
    Date Published:
    15/01/2013
    File Size:
    1.1 MB
    1.2 MB
    1 KB
    1 KB
      The Microsoft ODBC Driver 11 for SQL Server provides robust data access to Microsoft SQL Server. It allows native C and C++ applications to leverage the standard ODBC API and connect to Microsoft SQL Server 2008, 2008 R2, SQL Server 2012, SQL Server 2014 and Windows Azure SQL Database. Microsoft ODBC Driver 11 for SQL Server also comes with powerful tools - sqlcmd and bcp.
  • System Requirements
    Supported Operating System
    Linux

      Either 64-bit Red Hat Enterprise Linux 5 or 64-bit Red Hat Enterprise Linux 6 with the following RPM packages installed from your distribution’s package repository: 64-bit SUSE Linux Enterprise 11 Service Pack 2 with the following packages installed:

      ODBC driver for 64-bit Red Hat Enterprise Linux 5 requires the following packages:
      • glibc
      • libgcc
      • libstdc++
      • e2fsprogs-libs
      • krb5-libs
      • openssl

      ODBC driver for 64-bit Red Hat Enterprise Linux 6 requires the following packages:
      • glibc
      • libgcc
      • libstdc++
      • krb5-libs
      • openssl
      • libuuid

      The unixODBC 2.3.0 Driver Manager built and installed according to the following instructions.
  • Install Instructions
      Download the Microsoft ODBC Driver 11 for SQL Server ODBC on Linux package for your platform by clicking one of the download buttons.

      Verify the integrity of your download:

      64-bit Red Hat Enterprise Linux 5
      • SHA2: 178280daf01a49b8322cd902b6440979adacd594c01cd2a1f081dda23dbfb343

      64-bit Red Hat Enterprise Linux 6
      • SHA2: e9b6bd33d174c7753b3a3f2d541713fbc156b46254484a169caa3f459dd828f7

      INSTALLING THE DRIVER MANAGER

      Important: Delete any driver manager packages installed on your computer before you install the unixODBC Driver Manager. Installing the unixODBC Driver Manager could cause a failure of an existing Driver Manager.

        Using the Installation Script:
        1. Make sure that you have root permissions.
        2. Go to the directory where the Microsoft SQL Server ODBC Driver download placed the file called msodbcsql-11.0.2270.0.tar.gz. Make sure that you have the *.tar.gz file that matches your version of Linux. To extract the files, execute the following command: tar xvzf msodbcsql-11.0.2270.0.tar.gz.
        3. Change to the msodbcsql-11.0.2270.0 directory and there you should see a file called build_dm.sh. You can run build_dm.sh to install the unixODBC Driver Manager.
        4. To see a list of the available options, execute the following command: ./build_dm.sh --help.
        5. When you are ready to install, and if your computer can access an external site via FTP, execute the following command: ./build_dm.sh.

          If your computer cannot access an external site via FTP, get unixODBC-2.3.0.tar.gz. You can get unixODBC-2.3.0.tar.gz from http://www.unixodbc.org. Click the Download link on the left side of the page to go to the download page. Then click the appropriate link to download unixODBC-2.3.0 (not unixODBC-2.3.1). UnixODBC-2.3.1 is not supported with this release of the Microsoft ODBC Driver 11 for SQL Server. Execute the following command to begin the unixODBC Driver Manager installation: ./build_dm.sh --download-url=file://unixODBC-2.3.0.tar.gz.
        6. Type YES to proceed with unpacking the files. This part of the process can take up to 5 minutes to complete
        7. After the script stops running, follow the instructions on the screen to install the unixODBC Driver Manager.

        You are now ready to install the driver. See Installing the Microsoft ODBC Driver for SQL Server on Linux for more information. 

        Manual Installation:

        If the installation script is unable to complete, configure and build the proper driver manager yourself.

        1. Remove any older installed version of unixODBC (for example, unixODBC 2.2.11). On Red Hat Enterprise Linux 5 or 6, execute the following command: yum remove unixODBC.
        2. Go to http://www.unixodbc.org. Click the Download link on the left side of the page to go to the download page. Then click the appropriate link to save the file unixODBC-2.3.0.tar.gz to your computer. UnixODBC-2.3.1 is not supported with this release of the Microsoft ODBC Driver 11 for SQL Server.
        3. On your Linux computer, execute the command: tar xvzf unixODBC-2.3.0.tar.gz.
        4. Change to the unixODBC-2.3.0 directory.
        5. At a command prompt, execute the command: CPPFLAGS="-DSIZEOF_LONG_INT=8".
        6. At a command prompt, execute the command: export CPPFLAGS.
        7. At a command prompt, execute the command: "./configure --prefix=/usr --libdir=/usr/lib64 --sysconfdir=/etc --enable-gui=no --enable-drivers=no --enable-iconv --with-iconv-char-enc=UTF8 --with-iconv-ucode-enc=UTF16LE".
        8. At a command prompt (logged in as root), execute the command: make.
        9. At a command prompt (logged in as root), execute the command: make install.

        You are now ready to install the driver. See Installing the Microsoft ODBC Driver 11 for SQL Server on Linux for more information.

      INSTALLING THE MICROSOFT ODBC DRIVER 11 FOR SQL SERVER ON LINUX

      To install the driver:
      1. Make sure that you have root permissions.
      2. Change to the directory where the ODBC Driver on Linux placed the file called msodbcsql-11.0.2270.0.tar.gz. Make sure that you have the *.tar.gz file that matches your version of Linux. To extract the files, execute the following command, tar xvzf msodbcsql-11.0.2270.0.tar.gz.
      3. Change to the msodbcsql-11.0.2270.0 directory and there you should see a file called install.sh.
      4. To see a list of the available installation options, execute the following command: ./install.sh.
      5. Make a backup of odbcinst.ini. The driver installation updates odbcinst.ini. odbcinst.ini contains the list of drivers that are registered with the unixODBC Driver Manager. To discover the location of odbcinst.ini on your computer, execute the following command: odbc_config --odbcinstini.
      6. Before you install the driver, execute the following command: ./install.sh verify. The output of ./install.sh verify reports if your computer has the required software to support the ODBC Driver on Linux.
      7. When you are ready to install the ODBC Driver on Linux, execute the command: ./install.sh install. If you need to specify an install command (bin-dir or lib-dir), specify the command after the install option.
      8. After reviewing the license agreement, type YES to continue with the installation.

      Installation puts the driver in /opt/microsoft/msodbcsql/11.0.2270.0. The driver and its support files must be in /opt/microsoft/msodbcsql/11.0.2270.0.

      To verify that the ODBC Driver on Linux was registered successfully, execute the following command: odbcinst -q -d -n "ODBC Driver 11 for SQL Server"