Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
At work, I admin a half dozen or so different Oracle servers, and sometimes it's a pain to try and remember which particular DB is on which machine, so I wrote a small script to allow me to RDC to the correct machine given a DB name. Using wperl.exe rather than perl.exe gets rid of the console window opening up when you run it.
#!C:\perl\bin\wperl.exe -w use strict; use warnings; use Win32::Process; use Tk; my $mw = MainWindow->new; $mw->Label(-text => 'Oracle DB:')->pack; my $db = $mw->Entry( -width => 20, )->pack; $db->bind('Tk::Entry', '<KeyPress-Return>', \&connect); $db->bind('Tk::Entry', '<KeyPress-Escape>', sub { exit }); $db->focus; my $message = $mw->Message(-justify => 'center', -text => '')->pack; MainLoop; sub connect { my $dbname = $db->get; my ($server) = `tnsping $dbname` =~ /HOST=([^)]*)/; if (defined $server) { my $ProcessObj; Win32::Process::Create($ProcessObj, "c:\\winnt\\system32\\mstsc.exe", "mstsc /v:$server", 0, NORMAL_PRIORITY_CLASS, ".")|| die ErrorReport(); exit; } else { $message->configure(-text => "The database \"$dbname\" can't b +e found"); } } sub ErrorReport { print Win32::FormatMessage( Win32::GetLastError() ); }

In reply to RDC to Oracle Servers by Paladin

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2021-12-02 19:53 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (23 votes). Check out past polls.