--General query |
Thursday, 16 December 2010
Confluence : FIx space permissions via SQL
Posted by Ook at 09:21 0 comments
Friday, 19 November 2010
Keeping an SSH tunnel (passworded) running perniciously
* Download and compile sshpass and place in DIR http://sshpass.sourceforge.net/ * Create a script like this DIR=/? LOG=$DIR/ssh.log LOCAL_PORT=15000 REMOTE_SERVER=192.168.69.69 REMOTE_PORT=1521 echo "`date` - Restarting " >> $LOG export SSHPASS='PASSWORD' $DIR/sshpass -e ssh $USERNAME@ $REMOTE_SERVER -L${LOCAL_PORT}:localhost:${REMOTE_PORT} -N -o ServerAliveInterval=30 -o TCPKeepAlive=yes -o ServerAliveCountMax=172800 echo "`date` - Ending " >> $LOG * Add the following to /etc/inittab - replace xxxx with a unique id, USER with the user to login as and and script.sh accordingly with full path xxxx:35:respawn:/bin/su - USER "/?/script.sh" * Get the init process to reload (as root) kill -HUP 1 * Test |
Posted by Ook at 06:14 0 comments
Thursday, 18 November 2010
Keeping Your SSH Sessions Alive Through Firewalls
To send a keep alive every 4 minutes either change ~/.ssh/config or /etc/ssh/ssh_config to add Host * ServerAliveInterval 240 |
Posted by Ook at 01:00 0 comments
Wednesday, 13 October 2010
Windows : More RDP-related commands
Connect to a share to get an admin connectionsLog a user off a machine * logoff sessionId /server:targetmachine<br /> |
Posted by Ook at 07:24 0 comments
Tuesday, 5 October 2010
Sharepoint - Where is the data hidden
SELECT TOP 1000 [tp_ID] ,tp_author ,tp_version ,[datetime1]+8 x1 ,[datetime2]+7 x2 ,[datetime1] ,[datetime2] ,[nvarchar1] ,[nvarchar2] ,[nvarchar3] ,[nvarchar4] ,[nvarchar5] ,[nvarchar6] ,[nvarchar7] ,[datetime3] ,[datetime4] ,[datetime5] ,[int1] ,[int2] ,[int3] ,[int4] ,[int5] ,[int6] FROM [WSS_Content].[dbo].[AllUserData] where 1=1 --and tp_ListId = 'DA7307B0-4D77-4DEE-A347-D183BE27CCC3' and tp_DirName = 'hr/holidays/Lists/Absences' and nvarchar5 = 'IT Development' and tp_author = 51 and tp_ID = 709 order by datetime1 desc |
Posted by Ook at 04:31 0 comments
Thursday, 9 September 2010
Perl : One liner to find files less than an hour old in a dir
perl -e 'for ( glob "./*" ) { system "ls -l $_" if ( -M $_ <= (1/24) ) };' |
Posted by Ook at 05:40 0 comments
Tuesday, 7 September 2010
iTunes Error 9808
Itunes error -9808 logging into the iTunes Music Store In Internet Explorer, go up to Tools > Internet Options. Then go to the last tab, Advanced, and scroll down to the Security section. It is the fifth box down and make sure "Check for server certificate revocation (requires restart)" is unchecked. Then access the iTunes Store. |
Posted by Ook at 09:57 0 comments
Wednesday, 25 August 2010
Windows 7 : Show File types
|
Posted by Ook at 14:43 0 comments
Thursday, 19 August 2010
Oracle : Auditing object access in 9i
Peter Lawes added a comment - 19/Aug/10 11:40 AM
|
Posted by Ook at 03:40 0 comments
Labels: Oracle
Monday, 2 August 2010
Excel : Remove all hyperlinks
In the spreadsheet * Press Alt-F11 to open the VB macro editor * Select the required sheet * Enter the following macro code Sub ZapHyperlinks() Cells.Hyperlinks.Delete End Sub * Run the code - Green triangle or Menu->Run->Run Macro or F5 (possibly) * This should remove all hyperlinks in the entire sheet |
Posted by Ook at 06:24 0 comments
Monday, 26 July 2010
Oracle : Impdp - objects that can be included/excluded
-- for database level export/import: |
Posted by Ook at 07:00 0 comments
Labels: Oracle
Thursday, 22 July 2010
Oracle : Drop a temp tablespace temp file
alter database tempfile '/u03/volnewdev7data/oradata/NEWDEV3/temp_02.dbf' drop including datafiles; |
Posted by Ook at 02:42 0 comments
Labels: Oracle
Wednesday, 21 July 2010
Oracle : Password file
At command line |
Posted by Ook at 06:49 0 comments
Labels: Oracle
Thursday, 15 July 2010
Oracle : Remove 11.1 RAC cluster
Use cluster remove tool found : http://download.oracle.com/otndocs/products/clustering/deinstall/clusterdeconfig.zip This is a command line tool - unzip on node and de-install database home then crs home ./clusterdeconfig -home /u01/app/crs/11.1.0/crs -checkonly ./clusterdeconfig -home /u01/app/crs/11.1.0/crs ./clusterdeconfig -home /u01/app/oracle/product/11.1.0/db_1 -checkonly ./clusterdeconfig -home /u01/app/oracle/product/11.1.0/db_1 Need to run a 3 root scripts on each node |
Posted by Ook at 03:22 0 comments
Labels: Oracle
Wednesday, 14 July 2010
Linux : Getting hardware info from the command line
dmidecode |
Posted by Ook at 06:30 0 comments
Labels: Linux
Thursday, 1 July 2010
CVS : Pre-tag check failure
Very annoying and a completely useless error message This may be caused by a validation rule being set up on tags - eg. disallowing them to be moved/deleted Look at ../CVS/CVSROOT/taginfo which matches items being tagged to an executable to validate the action eg a line like DEFAULT /usr/local/bin/stop_tag_hack.sh will redirect to the shell script which can contain something like the following to stop deletes or changes : TAG_OP=$2 if [ "$TAG_OP" != "add" ]; then exit -1 # exit 0 fi |
Posted by Ook at 06:18 0 comments
Monday, 28 June 2010
Mysql : Reset root password
service mysql stop |
Posted by Ook at 06:42 0 comments
Windows : Remove IE advanced security
* This is done by uninstalling the windows component Control Panel->Add or Remove Programs->Add/Remove Windows Components->Stuff |
Posted by Ook at 03:33 0 comments
Monday, 14 June 2010
RMAN : Simple restore of archive log to default location
$ORACLE_HOME/bin/rman nocatalog connect target dba_cron/password run { ALLOCATE CHANNEL c1 DEVICE TYPE DISK; restore archivelog sequence 214629; restore archivelog sequence 214630; } |
Posted by Ook at 06:16 0 comments
Labels: Oracle
Wednesday, 26 May 2010
Windows : DesktopOk - desktop icon organizer that supports Windows 7 and 64bit
Seems good so far http://www.softwareok.com/?Download=DesktopOK&goto=../Download/DesktopOK_x64.zip |
Posted by Ook at 01:58 0 comments
Friday, 7 May 2010
Outlook: Suppress notification popups
To turn this feature off, click Tools, Options, Email Options, and Advanced Email Options |
Posted by Ook at 03:54 0 comments
Friday, 30 April 2010
MS SQL: Expensive queries
Also SELECT TOP 20 SUBSTRING(qt.text, (qs.statement_start_offset/2)+1, ((CASE qs.statement_end_offset WHEN -1 THEN DATALENGTH(qt.text) ELSE qs.statement_end_offset END - qs.statement_start_offset)/2)+1), qs.execution_count, qs.total_logical_reads, qs.last_logical_reads, qs.min_logical_reads, qs.max_logical_reads, qs.total_elapsed_time, qs.last_elapsed_time, qs.min_elapsed_time, qs.max_elapsed_time, qs.last_execution_time, qp.query_plan FROM sys.dm_exec_query_stats qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) qt CROSS APPLY sys.dm_exec_query_plan(qs.plan_handle) qp WHERE qt.encrypted=0 ORDER BY qs.total_logical_reads DESC
You can load the trace into profiler, or use ClearTrace <code><span class="pln">SELECT </span><span class="pun">*</span><span class="pln"> INTO </span><span class="typ">TraceTable</span><span class="pln"><br />FROM </span><span class="pun">::</span><span class="pln">fn_trace_gettable</span><span class="pun">(</span><span class="str">'C:\location of your trace output.trc'</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">default</span><span class="pun">)</span><span class="pln"><br /></span></code> Then you can run a query to aggregate the data such as this one: <code><span class="pln">SELECT COUNT</span><span class="pun">(*)</span><span class="pln"> AS </span><span class="typ">TotalExecutions</span><span class="pun">,</span><span class="pln"> <br /> </span><span class="typ">EventClass</span><span class="pun">,</span><span class="pln"> CAST</span><span class="pun">(</span><span class="typ">TextData</span><span class="pln"> </span><span class="kwd">as</span><span class="pln"> nvarchar</span><span class="pun">(</span><span class="lit">2000</span><span class="pun">))</span><span class="pln"><br /> </span><span class="pun">,</span><span class="pln">SUM</span><span class="pun">(</span><span class="typ">Duration</span><span class="pun">)</span><span class="pln"> AS </span><span class="typ">DurationTotal</span><span class="pln"><br /> </span><span class="pun">,</span><span class="pln">SUM</span><span class="pun">(</span><span class="pln">CPU</span><span class="pun">)</span><span class="pln"> AS </span><span class="typ">CPUTotal</span><span class="pln"><br /> </span><span class="pun">,</span><span class="pln">SUM</span><span class="pun">(</span><span class="typ">Reads</span><span class="pun">)</span><span class="pln"> AS </span><span class="typ">ReadsTotal</span><span class="pln"><br /> </span><span class="pun">,</span><span class="pln">SUM</span><span class="pun">(</span><span class="typ">Writes</span><span class="pun">)</span><span class="pln"> AS </span><span class="typ">WritesTotal</span><span class="pln"><br />FROM </span><span class="typ">TraceTable</span><span class="pln"><br />GROUP BY </span><span class="typ">EventClass</span><span class="pun">,</span><span class="pln"> CAST</span><span class="pun">(</span><span class="typ">TextData</span><span class="pln"> </span><span class="kwd">as</span><span class="pln"> nvarchar</span><span class="pun">(</span><span class="lit">2000</span><span class="pun">))</span><span class="pln"><br />ORDER BY </span><span class="typ">ReadsTotal</span><span class="pln"> DESC<br /></span></code> Once you have identified the costly queries, you can generate and From http://stackoverflow.com/questions/257906/how-can-i-log-and-find-the-most-expensive-queries |
Posted by Ook at 06:46 0 comments
Windows : Trace recent rdp sessions
Install log parser Create a bat file like (change server accordingly): echo off cls c: cd "c:\Program Files\Log Parser 2.2\" logparser.exe file:TSLoginsDetails_More.sql?source=\\server\Security -o:DATAGRID Create a sql file like : SELECT timegenerated, EXTRACT_TOKEN(Strings,0,'|') AS User, EXTRACT_TOKEN(Strings,4,'|') AS ClientName, EXTRACT_TOKEN(Strings,5,'|') AS ClientAddress FROM %Source% WHERE EventID=682 ORDER BY timegenerated desc Run the bat file as admin |
Posted by Ook at 03:42 0 comments
Thursday, 29 April 2010
MS Sql : Ctas = SELECT INTO
In Oracle create table T1 as select * from T1 The equivalent of that in Sql Server is SELECT INTOselect * into T2 from T1 |
Posted by Ook at 09:02 0 comments
Labels: Oracle
Wednesday, 28 April 2010
Windows : Audit recent RDP logins
If the login/logoff is being audited in group policy (default?)
|
Posted by Ook at 06:29 0 comments
Monday, 26 April 2010
Excel: Worksheet splitter vb
Sub SalesmanToSheet() |
Posted by Ook at 07:35 0 comments
Thursday, 22 April 2010
WIndows : Stop Robocopy trying forever
robocopy srcDir destDir /R:2 /W:10 /MIR' retry and wait between attempts - default is 1million and 30 seconds |
Posted by Ook at 07:53 0 comments
SQL Server: Listing sessions in 2000
SELECT DB_NAME(dbid) as 'Database Name', COUNT(dbid) as 'Total Connections' FROM master.dbo.sysprocesses WITH (nolock) WHERE dbid > 0 GROUP BY dbid SELECT DB_NAME(dbid) as 'Database Name', a.* FROM master.dbo.sysprocesses a WITH (nolock) WHERE dbid > 0 |
Posted by Ook at 01:21 0 comments
Thursday, 11 March 2010
SQLServer : Object sizes Report
USE DEALHUB_ARCH1 select 'Database Name: ', db_name() set nocount on if exists(select name from tempdb..sysobjects where name='##tmp') drop table ##tmp create table ##tmp(nam varchar(50), rows int, res varchar(15),data varchar(15),ind_sze varchar(15),unsed varchar(15)) go declare @tblname varchar(50) declare tblname CURSOR for select name from sysobjects where xtype='U' open tblname Fetch next from tblname into @tblname WHILE @@FETCH_STATUS = 0 BEGIN insert into ##tmp exec sp_spaceused @tblname FETCH NEXT FROM tblname INTO @tblname END CLOSE tblname deallocate tblname go select nam Table_Name,rows Total_Rows,res Total_Table_Size,data Data_size,ind_sze Index_Size,unsed Unused_Space from ##tmp drop table ##tmp |
Posted by Ook at 06:26 0 comments
Monday, 8 March 2010
Audacity : Recording from a sound card in Vista
|
Posted by Ook at 09:53 0 comments
Friday, 5 March 2010
Oracle Dataguard : dgmgrl - various commands
<b>Start dgmgrl
<b>Check the configuration status<br /></b>
<b>Create/enable configuration<br /></b>
<b>Stop transmit of dbs from primary <br /></b>
<b>Temporarily stop broker managing and monitoring a standby database.<br /></b>Switchover
<b>Manual Failover<br /></b>
|
Posted by Ook at 06:33 0 comments
Labels: Oracle
Saturday, 27 February 2010
Saturday, 13 February 2010
Redhat : Up2date crib
up2date --showall | grep libaio up2date download unixODBC-devel up2date download unixODBC-devel--arch-i386 up2date --install unixODBC-devel |
Posted by Ook at 05:59 0 comments
Thursday, 11 February 2010
MS SQL : List all tables and columns
SELECT SysObjects.[Name] as TableName, SysColumns.[Name] as ColumnName, SysTypes.[Name] As DataType, SysColumns.[Length] As Length FROM SysObjects INNER JOIN SysColumns ON SysObjects.[Id] = SysColumns.[Id] INNER JOIN SysTypes ON SysTypes.[xtype] = SysColumns.[xtype] WHERE SysObjects.[type] = 'U' and SysColumns.name like '%ap%' ORDER BY SysObjects.[Name] |
Posted by Ook at 02:32 0 comments
Wednesday, 10 February 2010
Vmware : Direct shortcut to a Vsphere machine
D:\Program Files\VMware\Infrastructure\Virtual Infrastructure Client\4.0\vmware-vmrc.exe" -h 192.168.69.42 -u root -p PASSWORD -d "[datastore1] Ninefingers2/Ninefingers2.vmx" -X -h Vsphere host -u User -p Passord -d Datastore path to vmx file -X Cant remember |
Posted by Ook at 14:20 0 comments
Labels: VMWare
Oracle Dataguard : Bring standby in line using rman
* ON STANDBY {noformat} sqlplus / as sysdba SQL>startup mount SQL>select current_scn from v$database; CURRENT_SCN ----------- 151214061 {noformat} * ON LIVE {noformat} export ORACLE_SID=FOSDB . oraenv $ORACLE_HOME/bin/rman nocatalog RMAN>connect target DBA_CRON/DBA_CRON RMAN>backup incremental from scn 151214061 database format '/b01/volbackupfos/FOSDB/201002/ForStandby_%U' tag 'FORSTANDBY'; RMAN>backup current controlfile for standby format '/b01/volbackupfos/FOSDB/201002/ForStandby_ctl.bkp'; scp * oracle@slofosdb01:/u03/volfoslivedata01/oradata/201002 {noformat} OR - actually did a full backup and transfer {noformat} RMAN>backup full database format '/b01/volbackupfos/FOSDB/201002/ForStandby_%U' tag 'FORSTANDBY'; RMAN>backup current controlfile for standby format '/b01/volbackupfos/FOSDB/201002/ForStandby_ctl.bkp'; scp * oracle@slofosdb01:/u03/volfoslivedata01/oradata/201002 {noformat} {noformat} * Must stop dataguard or recovery complains cannot get unique lock on files sqlplus / as sysdba SQL> alter database recover managed standby database cancel; {noformat} * ON STANDBY {noformat} $ORACLE_HOME/bin/rman nocatalog RMAN> connect target DBA_CRON/DBA_CRON RMAN> shutdown immediate; RMAN> startup nomount; RMAN> restore standby controlfile from '/u03/volfoslivedata01/oradata/201002/ForStandby_ctl.bkp'; RMAN> shutdown immediate; RMAN> startup mount RMAN> -- Catalog the copied files RMAN> catalog start with '/u03/volfoslivedata01/oradata/201002/' RMAN> restore database; RMAN> recover database noredo; RMAN> exit {noformat} {noformat} sqlplus / as sysdba SQL>startup mount SQL> alter database recover managed standby database disconnect; {noformat} * Needed to recreate STANDBY LOGFILEs as named differently from source db {noformat} sqlplus / as sysdba SQL> alter database recover managed standby database cancel; Database altered. select 'alter database drop standby logfile group ' group# ';' from v$standby_log; --Run generated script --This plus others ALTER DATABASE ADD STANDBY LOGFILE '/u02/volfoslivelogs01/oradata/FOSDGFOSDB_1srl2.f' SIZE 100M REUSE; {noformat} sqlplus / as sysdba SQL>startup mount SQL> alter database recover managed standby database disconnect; {noformat} |
Posted by Ook at 04:44 0 comments
Labels: Oracle
Oracle Dataguard : Check status from SQL
--On secondary select current_scn from v$database --On primary select scn_to_timestamp(287481398) from v$database union all select scn_to_timestamp(current_scn) from v$database; If too far apart may need to force log switch on primary ALTER SYSTEM SWITCH LOGFILE; Also see select * from V$DATAGUARD_STATUS; |
Posted by Ook at 04:44 0 comments
Labels: Oracle
Friday, 5 February 2010
Oracle : Rolling sequences forward
declare dummy number; begin for sq in ( select sequence_owner||'.'||sequence_name nm from dba_sequences where sequence_owner in ( 'CLIENTDBO','DEALERTOOLS_DBO','GAINDBO','IT_JOB_LOG','MXDBO','MYBROKERDBO', 'NEWTOPSDBO','ODFSDBO','ODL_DBADMIN_DBO','ODL_DBSERVICES_DBO','ODL_USERAPPS_DBO', 'PRODUCTDBO','RECONCILIATIONSDBO','SETTLEMENTSDBO','USER_ADMIN_SYS','WEB') ) loop dbms_output.put_line(sq.nm); for i in 1..10000 loop execute immediate 'select '||sq.nm||'.nextval from dual' into dummy; end loop; end loop; end; |
Posted by Ook at 08:30 0 comments
Labels: Oracle
Thursday, 28 January 2010
Powershell : Get inner errors for more info (sometimes)
Statement that fails # Trap { # write-output "herea" # $_.Exception # $err = $_.Exception # while ( $err.InnerException ) # { # $err = $err.InnerException # write-output $err.Message # }; # continue # } |
Posted by Ook at 01:32 0 comments
Wednesday, 20 January 2010
Powershell : IUnable to install CTP3 - Access Denied Error
Reason was a anti-confickr strategy of adding a permission to stop values being changed in a registry key : HKLM, Software\Microsoft\Windows Nt\CurrentVersion\Svchost This has advanced acl perms set to Deny Everyone Set Value |
Posted by Ook at 07:21 0 comments
Tuesday, 12 January 2010
Powershell - Performance Diagnostics reports error
When using powershell to query performance counters (via New-Object Diagnostics.PerformanceCounter) getting an errors (The network path was not found) Fix - Assuming wiondows firewall on the target machine is turned on enable File and Printer Sharing in the exceptions on the target |
Posted by Ook at 08:48 0 comments
[ Show » ]
Peter Lawes
added a comment - 19/Aug/10
10:47 AM