Oracle ILOM CLI access - powershell

I am trying to access an Oracle ILOM interface via command line to read the event log.
As far as I know there are several ways to do this, but none work for me and my environment:
IPMItools: seems to be available only for Linux or on the CD/DVD that originally came with the server, which of course was lost;
SSH access (via putty) works fine, but I could not figure a way to automate logging in, running a command on the remote server and reading the result (still looking into it);
command line SSH access via plink works fine, but as soon as I try adding a command to run on the server (e.g. plink.exe -l root -pw password FQDN help) I get the error message "shell: Invalid credentials". adding the -t option did not change anything;
the SSH.NET library for powershell fails with the following exception "Exception calling "Connect" with "0" argument(s): "No suitable authentication method found to complete authentication". Documentation suggests adding a generated public RSA key to the server to allow for possword-less login. That cannot be done on Sun ILOMs;
Connecting via a serial port as detailed here does not work for me. I must be missing something from the posted code, but I simply cannot open a connection.
Has anyone ever tried to access an ILOM from command line? Could anyone offer a pointer as to what might work?
Ideally I'd like to automate this in a powershell script to be run from a Windows machine, but I'm open to any suggestions that do not require Visual Studio to implement.
Any help would be greatly appreciated!

ipmi and ssh remote command only supports in ilom3.0+.
if you are using alom, ilom2.0, or sxcf, you won't be able to use these tools.
I'd recommand to use python with pexpect https://pexpect.readthedocs.io/en/stable/.
check my snippet https://gist.github.com/happlebao/ca143cf3feaf60ca8ef75f7a66cf8a8a

Related

Connect Postman to Postgres

There is a problem.
I need to access Postgres Database from Postman. Database isn't local, it is on a server, but I have full connection string (host, db_name, user_name/password, scheme).
Any chances to do it?
I tried PostgREST, but I can't install it. I have LIBPQ.dll is not found error. I installed it but it was no help, I still have 0xc00007b error.
So that I can't install PostgREST.
Should I install it on the server where DB is located?
And is there any other way?
update: I managed to overcome all the errors (here is the note how to overcome 0xc00007b error: https://postgrest.org/en/stable/install.html).
Now I can call postgrest from cmd with the flag --help, but it's still not connected to the database.
update2: I managed the connection by putting postgrest.conf filled file in the same directory as postgrest.exe file and running in from cmd.
search for app and browser control in start menu, then select exploitation control :
set randomize image ASLR to off

psql client failing to import dump file - the system cannot find the specified file

I'm attempting to import an SQL dump in PgAdmin 4 using the psql client - However the error message returned is - The system cannnot find the file specified.
Here is a screenshot of my psql client -
The file films.sql is currently stored on my desktop, but I suspect the default location that the psql client accesses is not my desktop? Is there anyway to set the location that the client looks in order to resolve this?
The file SQL is viewable here: https://github.com/datacamp/courses-intro-to-sql/tree/master/datasets
I simply want to get the database on my local machine so that I don't need to store queries in an online learning platform. It would be best if this database is available locally to query and practice on.
I've attempted to execute the whole SQL file as a query on the films database but this does not seem to be working either and returns 'Asynchronous query execution/operation underway.
Query returned successfully in 388 msec.' - However it seems to be the case that the Asynchronous query never completes when I refresh the database.
Please can someone help?
Just give the path to your file:
psql -d my_database -f /path/to/the/file.sql
psql -d my_database -f C:/path/to/the/file.sql
Depending on whether you are on a unix/linux machine or Windows.
Oh, and if you aren't familiar with file paths you may want to take a step back and become more familiar with general computer terminology before diving into a RDBMS. Your learning will be much easier if you have a solid foundation to build upon.
I suspect this question might be moot for the asker at this point, but for anyone else stumbling upon it like I did: the interactive connection info prompts are provided by a batch script (in Windows, I'd guess there's an analogous shell script for Unix) called runpsql.bat, which then just passes your inputs as commandline arguments to the psql.exe executable. I was getting this error because I had migrated my Postgres installation and the batch script was calling a nonexistent path for psql.exe, hence The system cannot find the file specified. I edited runpsql.bat to point to the correct location of psql.exe and that resolved the issue. So for OP, I would look into PgAdmin4 and see where it's (presumably) calling runpsql.bat, then make sure that that calls psql.exe with the correct path.

Use built-in SSH in Oracle SQL Developer instead of using PuTTY first

I don't have extensive knowledges about Oracle SQL Developer (Version 17.2) and SSH tunnel. I have been using PuTTY (KiTTY is the software I used) to establish SSH tunnel to connect to the database. This is the example of how I set up originally with KiTTY. Also, when I start the session where a command prompt window will pop up, I'll need to enter username and password. Let's assume the Username is username and the Password is password. And for the database, the Username is database_username and the Password is database_password.
SSH Setup:
Tunnel Setup:
I learned that you can use SSH (View > SSH) function directly from Oracle SQL Developer, and I have tried for two days but didn't work. From the information I have attached in the two pics above, will I be able to use the built-in SSH function or do I have to always use PuTTY? This is how I set up currently:
SSH in Oracle SQL Developer Setup:
How should I change the built-in SSH setup in order for me to connect to database through SSH? Will this be possible? If so, can you show me exactly what I need to enter the information into those fields (please use mine so I can follow each step)? I just think this process can be simplified within one program.
I finally found the answer for myself after two days of searching and a coworker's advice. Here is what you do to use built-in SSH function in Oracle SQL Developer that also requires SSH Tunnel. And no more PuTTY is needed for this process.
SSH Setup:
As shown in the pic below, this is what you need to enter. Please note there are two Name's fields. You can make up any name you like to use. Don't forget to perform a Test run to ensure this works. To Test run, go to SSH Hosts window, right click on the SSH connection and select Test.
Now the tricky part is here. You should see there is a Connections window on the upper left corner. Click the green plus icon button to add a New Connection.
Database Connection Setup:
Fill out the info as you can see the pic below for example. The key is to change the Connection Type to SSH, Port Forward should also point to the SSH connection that you setup above, and you should have a Service name provided by your DBA team. Once this is set, you can perform a quick Test run and see if everything is working.
The good thing about this setup is that you don't need to run PuTTY on the side. You can simply click the database name and it will prompt you the password and that is it.
P.S. I heard there is a way to store the password using SSH key but I am not familiar with the process and still trying to figure that out. Maybe post your steps here and I will definitely upvote for you.

What is a straightforward way to connect to Postgres.app with dbext (in Vim)?

When I try to connect to my Postgres.app db using dbext, I get the following error:
dbext:PostgreSQL requires a '$HOME/.pgpass' file in order to authenticate. This file is
missing. The binary 'psql' does not accept commandline passwords.
Other programs connect just fine by using a "local" connection. (Postgres.app runs with my userid.)
In vim :!which psql correctly prints /opt/local/bin/psql (which I have symlinked to the one in the Postgres.app bin directory). And Postgres.app is set up to use "local" authentication and there's no clear sense of where a pg_hba.conf file would go (there is no etc directory in the app bundle). Moreover, Postgres.app doesn't have anything in its documentation about changing access configuration.
I've tried using dbext's :DBPromptForBufferParameters directly, as well as #tpope's vim-rails plugin (which returns without comment from dbext setup via :Rdbext.
So what do I do to get dbext to connect using a "local" connection?
Note - I spent a LOT of time trying to figure this out without trying the obvious, thus the post even when I already have the answer. I'm also curious to see if anyone else has a different approach.
It turns out you can just make an empty ~/.pgpass file (restricting read-write permissions to your userid only to avoid warnings). This was counterintuitive for me (since there is in fact no password), but I suppose in retrospect it's obvious I should have tried it.
I'll point this out on the dbext issue tracker.

Changing the 'Server Collation' after installation

I want to change the Server Collation of SQL Server 2008 R2
As all opinions says (including MSDN) the following command should be executed:
E:\setup.exe /q /ACTION=RebuildDatabase /INSTANCENAME=MSSQLSERVER /SAPWD=”**″ /SQLSYSADMINACCOUNTS=”HEREISMYPROBLEM” /SqlCollation=SQL_Latin1_General_CP1_CI_AS
As I Pointed, my problem is with the SYSADMINACCOUNT paremeter because the error that I get is:
The Windows account ”blablabla” does not exist and cannot be provisioned as a SQL Server system administrator.
I tried all possible windows accounts that may be, but It's not working.
Please can you guide me how to know my correct windows account.
The MSDN link that shows this problem is
here
This page describes the switches and says to use "DOMAIN\User" format, for example:
BUILTIN\Administrators MyDomain\MyUser
For anyone else that gets stuck with this problem and cant find an answer. The commands work you just need to run cmd as an administrator for it to work.
Use this batch file for change collation on SQL Server 2008
But you need edit batch file for set you instance and target collation.
Stop SQL Server Service when you run this file
File need Run as administrator
If don't work well (maybe access problem), you can use cmd (Run as admin) and run batch file steps on cmd