Cygwin + WMIC Pagefile Setup - cygwin

I've been trying to modify the pagefile size on a drive using CYGWIN as the majority or our servers only have access to cygwin and not straight CMD.
Here's an overview of my trials, note that the last command is successful but I cannot run it as it requires to first type 'cmd' then the command interactively and cannot be done via script (as far as I could get):
Administrator#dock ~
$ wmic pagefileset where name='d:\\pagefile.sys' set InitialSize=10000,MaximumSize=20000
ERROR:
Description = Invalid query
Administrator#dock ~
$ cmd /c "wmic pagefileset where name='d:\\pagefile.sys' set InitialSize=10000,MaximumSize=20000"
ERROR:
Description = Invalid query
Administrator#dock ~
$ powershell -c "wmic pagefileset where name='d:\\pagefile.sys' set InitialSize=10000,MaximumSize=20000"
Invalid format.
Hint: <assignlist> = <propertyname>=<propertyvalue> [, <assignlist>].
Administrator#dock ~
$ cmd
Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.
C:\cygwin\home\Administrator>wmic pagefileset where name='d:\\pagefile.sys' set InitialSize=10000,MaximumSize=20000
wmic pagefileset where name='d:\\pagefile.sys' set InitialSize=10000,MaximumSize =20000
Updating property(s) of '\\DOCK\ROOT\CIMV2:Win32_PageFileSetting.Name="D:\\pagef ile.sys"'
Property(s) update successful.
Any suggestions on how I could run this command via CYGWIN and not get an 'Invalid Query'?

Administrator#darwin-test7-wi ~
$ wmic pagefileset where 'name="C:\\pagefile.sys"' delete
Deleting instance \\DARWIN-TEST7-WI\ROOT\CIMV2:Win32_PageFileSetting.Name="C:\\pagefile.sys"
Instance deletion successful.
Administrator#darwin-test7-wi ~
$ wmic pagefileset create name="C:\\pagefile.sys"
Instance creation successful.
Administrator#darwin-test7-wi ~
$ wmic pagefileset where 'name="C:\\pagefile.sys"' set InitialSize=512,MaximumSize=512
Updating property(s) of '\\DARWIN-TEST7-WI\ROOT\CIMV2:Win32_PageFileSetting.Name="C:\\pagefile.sys"'
Property(s) update successful.

This was resolved by creating a .bat file and calling it from the .sh file which allowed for Pagefile updating.

Related

error running run file in centOS - bad display

I have a task to install Oracle 11g on a centOS 8 using VM (i'm new to linux / oracle).
I downloaded the Oracle files and unzipped them, then I tried to ./runInstaller but I get an error and this is the full terminal with error:
login as: admin
admin#192.168.163.129's password:
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Thu May 21 09:26:48 2020 from 192.168.163.1
[admin#oracledb ~]$ cd Downloads
[admin#oracledb Downloads]$ cd database
[admin#oracledb database]$ ls
doc linux.x64_11gR2_database_1of2 response runInstaller stage
install linux.x64_11gR2_database_2of2 rpm sshsetup welcome.html
[admin#oracledb database]$ ./runInstaller
Starting Oracle Universal Installer...
Checking Temp space: must be greater than 120 MB. Actual 2027 MB Passed
Checking swap space: must be greater than 150 MB. Actual 1759 MB Passed
Checking monitor: must be configured to display at least 256 colors
>>> Could not execute auto check for display colors using command /usr/bin/xdpyinfo. Check if the DISPLAY variable is set. Failed <<<<
Some requirement checks failed. You must fulfill these requirements before
continuing with the installation,
Continue? (y/n) [n] y
>>> Ignoring required pre-requisite failures. Continuing...
Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-05-21_09-43-58AM. Please wait ...
DISPLAY not set. Please set the DISPLAY and try again.
Depending on the Unix Shell, you can use one of the following commands as examples to set the DISPLAY environment variable:
- For csh: % setenv DISPLAY 192.168.1.128:0.0
- For sh, ksh and bash: $ DISPLAY=192.168.1.128:0.0; export DISPLAY
Use the following command to see what shell is being used:
echo $SHELL
Use the following command to view the current DISPLAY environment variable setting:
echo $DISPLAY
- Make sure that client users are authorized to connect to the X Server.
To enable client users to access the X Server, open an xterm, dtterm or xconsole as the user that started the session and type the following command:
% xhost +
To test that the DISPLAY environment variable is set correctly, run a X11 based program that comes with the native operating system such as 'xclock':
% <full path to xclock.. see below>
If you are not able to run xclock successfully, please refer to your PC-X Server or OS vendor for further assistance.
Typical path for xclock: /usr/X11R6/bin/xclock
[admin#oracledb database]$
I am using putty and Xming but I still get this error.
Make sure your putty session is connecting with "x-11 port forwarding"
Be sure after you set this that you scroll back up to 'Session' and then 'save'

Oracle Database exists but error seen when referencing it

During installation of spacewalk using instructions from https://docs.oracle.com/cd/E92593_01/E90682/html/swk22-svr-install.html we require
We require to use a database. So using dbca i created an Oracle database called orcl.ie.oracle.com
However this seems to either not see it or not connect. Not sure why - see below.
spacewalk-setup --external-oracle
* Setting up Oracle environment.
* Setting up database.
** Database: Setting up database connection for Oracle backend.
Global Database Name or SID (requires tnsnames.ora)? orcl.ie.oracle.com
Database hostname [localhost]?
Database (listener) port [1521]?
*** Database connection error: ORA-12541: TNS:no listener (DBD ERROR: OCIServerAttach)
Global Database Name or SID (requires tnsnames.ora)?
From feedback, here is output of lsnctl stat
[root#dub-mgrfarm113 dbhome_1]# pwd
/opt/oracle/product/19c/dbhome_1
[root#dub-mgrfarm113 dbhome_1]# echo $ORACLE_HOME
/opt/oracle/product/19c/dbhome_1/
[root#dub-mgrfarm113 dbhome_1]# echo $PATH
[oracle#dub-mgrfarm113 oracle]$ ./product/19c/dbhome_1/bin/lsnrctl stat
LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 14-NOV-2019 11:16:45
Copyright (c) 1991, 2019, Oracle. All rights reserved.
Message 1053 not found; No message file for product=network, facility=TNSTNS-12541: Message 12541 not found; No message file for product=network, facility=TNS
TNS-12560: Message 12560 not found; No message file for product=network, facility=TNS
TNS-00511: Message 511 not found; No message file for product=network, facility=TNS
Linux Error: 111: Connection refused
can you post what the following command gives on your server:
lsnrctl stat
(started connected as the user who owns the oracle installation, and after initializing your env to use the database installation, i.e. correct ORACLE_HOME and PATH)
UPDATE (Using this as I cannot yet comment on posts):
You show the ORACLE_HOME var from root, then you execute lsnrctl as 'oracle'. The fact that you had to use the full path to start lsnrctl indicates that your env is not properly set).
Please connect as 'oracle', then do (and enter the db name when asked for):
. oraenv
then run the lsnrctl command

WMIC differences in Linux vs Windows

This wmic query (NODE, USER, PASS all desensitised)...
wmic /NODE:10.00.00.1 /LOCALE:MS_409 /PRIVILEGES:ENABLE /TRACE:OFF /INTERACTIVE:OFF /FAILFAST:OFF /USER:domain\my_user /PASSWORD:myPass! /OUTPUT:STDOUT /APPEND:STDOUT /AGGREGATE:ON class StdRegProv CALL EnumKey ^&H80000002,"Software\Microsoft\SystemCertificates\MY\Certificates"
^&H80000002 is the uint32 conversion of HKEY_LOCAL_MACHINE
... runs flawlessly in a CMD prompt in Windows. I can also run it in the context of a node package from my local windows machine with success, I'm going to assume this is because the wmic call is made specifically to the local machine (windows) where it is handled effortlessly. Returning to me a result containing what I require...
res.sNames [ 'BB731A3DD8F089A6D4E59AF9D706...' ]
I created a docker container running Alpine and node where I host an express application. I followed the instructions below to install WMIC on Linux...
https://askubuntu.com/questions/885407/installing-wmic-on-ubuntu-16-04-lts
This installed successfully.
Now when I run the exact same query from a bash prompt in Ubuntu either via my Node app or a direct command, I'm receiving this result:
Garne#MYCOMPUTERNAME MINGW64 ~
$ wmic.exe /NODE:10.00.00.1 /LOCALE:MS_409 /PRIVILEGES:ENABLE /TRACE:OFF /INTERACTIVE:OFF /FAILFAST:OFF /USER:domain\my_user /PASSWORD:myPass! /OUTPUT:STDOUT /APPEND:STDOUT /AGGREGATE:ON class StdRegProv CALL EnumKey ^&H80000002,"Software\Microsoft\SystemCertificates\MY\Certificates"
[1] 426
bash: H80000002,Software\Microsoft\SystemCertificates\MY\Certificates: No such file or directory
Garne#MYCOMPUTERNAME MINGW64 ~ $ ERROR: Description = Access is
denied.
I can't for the life of me work out whether this is due to a string formatting error in Linux vs Windows or whether Linux is running a different variant of wmic that isn't resolving my query correctly?
For anyone wondering, after hours of testing this with very obscure error messages. Make sure you escape absolutely everything in bash style not in a windows fashion.
Note:
\$ instead of ^&
Wrap USER value in ''
Wrap PASSWORD value in ''
References here:
https://manpages.debian.org/buster/bash/bash.1.en.html#QUOTING
$ wmic /NODE:10.23.0.11 /LOCALE:MS_409 /PRIVILEGES:ENABLE /TRACE:OFF /INTERACTIVE:OFF /FAILFAST:OFF /USER:'domain\my_user' /PASSWORD:'myPass!' /OUTPUT:STDOUT /APPEND:STDOUT /AGGREGATE:ON class StdRegProv CALL EnumKey \&H80000002,"Software\Microsoft\SystemCertificates\MY\Certificates"
Executing (StdRegProv)->EnumKey()
Method execution successful.
Out Parameters:
instance of __PARAMETERS
{
ReturnValue = 0;
sNames = {"BB731A3DD8F089A6D4E59AF9D70601F9CBB94A9D"};
};

How do I run Cosmos DB Emulator on Docker for Windows?

I'm trying to get Cosmos DB Emulator running on Docker for Windows but I am not having any luck. I am following the commands here:
https://learn.microsoft.com/en-us/azure/documentdb/documentdb-nosql-local-emulator
Specifically:
md %LOCALAPPDATA%\DocumentDBEmulatorCert 2>nul
docker run -v %LOCALAPPDATA%\DocumentDBEmulatorCert:c:\DocumentDBEmulator\DocumentDBEmulatorCert -P -t -i mominag/documentdb_emulator
I am getting various errors from Docker including "invalid bind mount". The command itself doesn't seem right so I've tried changing mominag/documentdb_emulator to microsoft/azure-documentdb-emulator but that has not worked. It doesn't help that this is my first real attempt at using Docker.
I also took a look at the following on GitHub which looks like the source of the commands in the Microsoft docs.
https://github.com/Azure/azure-documentdb-emulator-docker
UPDATE:
Here are the commands I am running and the errors that are returned.
PS C:\> md %LOCALAPPDATA%\DocumentDBEmulatorCert 2>nul
out-file : FileStream was asked to open a device that was not a file. For support for devices like 'com1:' or 'lpt1:',
call CreateFile, then use the FileStream constructors that take an OS handle as an IntPtr.
At line:1 char:1
+ md %LOCALAPPDATA%\DocumentDBEmulatorCert 2>nul
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (:) [Out-File], NotSupportedException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
PS C:\> docker run -v %LOCALAPPDATA%\DocumentDBEmulatorCert:c:\DocumentDBEmulator\DocumentDBEmulatorCert -P -t -i docume
ntdb_emulator
C:\Program Files\Docker\Docker\Resources\bin\docker.exe: Error response from daemon: invalid bind mount spec "%LOCALAPPD
ATA%\\DocumentDBEmulatorCert:c:\\DocumentDBEmulator\\DocumentDBEmulatorCert": invalid volume specification: '%LOCALAPPDA
TA%\DocumentDBEmulatorCert:c:\DocumentDBEmulator\DocumentDBEmulatorCert'.
See 'C:\Program Files\Docker\Docker\Resources\bin\docker.exe run --help'.
PS C:\>
If I remove the 2>nul the directory is created but I still get the same error on the docker run command.
According to your description, I have checked the command line via power shell, I found the directory is not created correctly as follows:
Note: you could replace %LOCALAPPDATA% with $env:LOCALAPPDATA.
When running the following command line to start the documentdb emulator:
docker run -v %LOCALAPPDATA%\DocumentDBEmulatorCert:c:\DocumentDBEmulator\DocumentDBEmulatorCert -P -t -i mominag/documentdb_emulator
I encountered the following error:
When I changing mominag/documentdb_emulator to microsoft/azure-documentdb-emulator, then I could start my documentdb emulator successfully as follows:

error running `sqlplus` as user `oracle`

Im trying to run sqlplus from user oracle in linux, but i only get the following error.
Error 6 initializing SQL*Plus
SP2-0667: Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
[ sqlplus ] completed with error code: 1
I have tried to run ./oracle_env.sh as user oracle and have tried it as user root as-well, but when I run the sqlplus / as sysdba command logged in as user oracle I get the above message.
Did I miss something, am I on completely the wrong track?
Here is a full output that I used/got.
`su - oracle
cd /u01/app/oracle/product/11.2.0/xe/bin
./oracle_env.sh
sqlplus / as sysdba`
If /u01/app/oracle/product/11.2.0/xe/bin/oracle_env.sh sets your ORACLE_HOME, and ORACLE_SID environment variables, you need to "source" it invoking it in the current environment) using the "dot" prefix:
. ./oracle_env.sh
In any case, looks like your environment variables (including LD_LIBRARY_PATH) may not be set correctly.

Resources