• InstallShield高级应用获取机机所有ORACLE服务列表


    //=====================================================================//
    // //
    // function GetOracleServerList //
    // 获取机机所有ORACLE服务列表//
    // purpose get the local oracle servers from the tnsnames.ora //
    // from the path %oraclepath%\nerwork\admin //
    // //
    // argment //
    // //
    // return local oracle server list //
    // //
    // author chenhuicong 2010-12-18 //
    // //
    //=====================================================================//


    EXPORT prototype LIST GetOracleServerList();

    function LIST GetOracleServerList()
    NUMBER nvHomeCount,nKeyType, nvSize,nFileHandle;
    LIST listID;
    STRING svOraclePath,svLine,svOraFileName,svOracleItem;
    INT iVal, iLength,iItemLen;
    begin
    //ora filename
    svOraFileName = "tnsnames.ora";
    // defaut regedit root
    RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

    //oralce regedit path
    if(RegDBGetKeyValueEx ("SOFTWARE\\ORACLE\\ALL_HOMES\\ID0", "PATH",nKeyType, svOraclePath, nvSize) = 0) then
    //oracle path
    svOraclePath= svOraclePath^"network\\admin\\";
    // Create a list to store lines from the file.
    listID = ListCreate (STRINGLIST);
    // Set the file mode to normal.
    OpenFileMode (FILE_MODE_NORMAL);
    // Open the file for editing.
    if(OpenFile (nFileHandle, svOraclePath, svOraFileName) = 0 ) then
    try
    // Get lines from the file into the list.
    while (GetLine (nFileHandle, svLine) = 0)
    if(svLine[0] != "#" && svLine[0] != " " && svLine[0] != "(") then
    iVal = 0;
    iLength = StrLength (svLine);
    while (iVal <= iLength)
    if(svLine[iVal] = "=" || svLine[iVal] = " ") then
    svLine[iVal] = NOTHING;
    endif;
    iVal++;
    endwhile;
    if(iLength > 0 ) then
    ListAddString (listID, svLine, AFTER);
    endif;

    endif;
    endwhile;
    // Close the file.
    CloseFile (nFileHandle);
    // Remove the list from memory.
    //ListDestroy (listID);
    catch
    CloseFile (nFileHandle);
    //ListDestroy (listID);
    endcatch;
    endif;
    endif;

    return listID;
    end;

    作者:chhuic

    出处:http://chhuic.cnblogs.com
    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

  • 相关阅读:
    PostgreSQL 模式(SCHEMA)
    PostgreSQL学习---模式schema
    psql 工具详细使用介绍
    CentOS 下 VNC Server 的配置与使用
    如何处理/boot/efi/EFI/cento from install of fwupdate-efi
    uGUI练习(二) Animate UI
    uGUI练习(一) Anchor
    uGUI练习 开篇
    Fix "Missing Scripts"
    用uGUI开发自定义Toggle Slider控件
  • 原文地址:https://www.cnblogs.com/chhuic/p/2495608.html
Copyright © 2020-2023  润新知