Pages

Wednesday, December 4, 2013

How to get Windows version from command line of remote servers

How to get windows version from command line of remote server ?



For one server:

D:\> reg query "\\172.69.0.79\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion
    ProductName    REG_SZ    Windows Server 2008 R2 Enterprise

NoteLogin to your client PC as domain user with local administrator privilege.




For multiple servers: (content republished, Source here)

Save the below code as a batch file:


REM Check OS Version on a remote server
@echo Off
pushd %~dp0
for /f %%a in (serverlist.txt) do (
Echo %%a is checked
reg query "\\%%a\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v ProductName

) >> OS_version_query_result.txt


In the same folder location of batch file, place the serverlist.txt file.
Just type one host name per line without any trailing space.

serverlist.txt read as below:

phygrsrv01
phyaprsrv01
172.36.88.101
10.1.0.122

Now execute the batch file, it creates a output file in the same location.

Monday, December 2, 2013

Manually Move + Delete Archive log [Windows]


### Below command deletes files ARC*.* from F:\Oracle_Arc with date older than 7 days:

FORFILES /P F:\Oracle_Arc /M ARC*.* /D -7 /C "cmd /c del @path"


### Below Command moves files ARC*.* from D:\Logs to F:\Arc with date older than 2 days: 

FORFILES /P D:\Logs /M ARC*.* /D -2 /C "cmd /c move @path F:\Arc"


ORA-08181 ORA-06512: at "SYS.SCN_TO_TIMESTAMP"

Version: 11.2.0.3

SQL> select name, open_mode, database_role from v$database;

NAME OPEN_MODE DATABASE_ROLE
--------- -------------------- ----------------
HSB62 READ ONLY PHYSICAL STANDBY

SQL> select scn_to_timestamp(current_scn) scn_sync_until from v$database;
select scn_to_timestamp(current_scn) scn_sync_until from v$database
*
ERROR at line 1:
ORA-08181: specified number is not a valid system change number
ORA-06512: at "SYS.SCN_TO_TIMESTAMP", line 1



OR


SQL> select current_scn from v$database;

CURRENT_SCN
--------------------
10588754037


SQL> select scn_to_timestamp(10588754037) scn_sync_until from v$database;
select scn_to_timestamp(10588754037) scn_sync_until from v$database
*
ERROR at line 1:
ORA-08181: specified number is not a valid system change number
ORA-06512: at "SYS.SCN_TO_TIMESTAMP", line 1



Workaround: To bounce the database and flush shared pool (doesn't worked for me..!)


Conclusion / Solution:

Bug 17214565.

There is no fixes for this bug currently.

The issue seems to be resolved in 12c.