How to update cursor limit for ORA-01000: maximum open cursors exceed
SELECT DECODE(value, NULL, 'PFILE', 'SPFILE') "Init File Type"
FROM sys.v_$parameter WHERE name = 'spfile';

SPFILE

alter system set open_cursors = 1000 scope=both;
alter system set processes = 500 scope=spfile;

PFILE

alter system set open_cursors = 1000;
oracle  database  error  ora-01000  parameters  set  fix 
july 2018
Recuperar datos de un tiempo pasado en base de datos
-------------------------------------
--Recuperar datos de un tiempo pasado
-------------------------------------
select * from crpdta.f4105 AS OF TIMESTAMP TO_TIMESTAMP('2017-06-09 13:30:00', 'YYY...
oracle  database  recover  data  table  from notes
july 2018
Best way to use multiple SSH private keys on one client
ssh -i <key location> login@server.example.com

From my .ssh/config:

Host myshortname realname.example.com
HostName realname.example.com
IdentityFile ~/.ssh/realname_rsa # private key for realname
User remoteusername

Host myother realname2.example.org
HostName realname2.example.org
IdentityFile ~/.ssh/realname2_rsa
User remoteusername
linux  ssh  config  key  public  private 
july 2018
ASM Add disk to diskgroup
# Comprobamos cuántos discos hay 'marcados' a nivel de sistema operativo como discos de uso para la instancia ASM:

[root@data900pd0 dev]# oracleasm scandisks
Reloading disk partitions: done
Clea...
oracle  database  admin  asm  diskgroup  disk  from notes
july 2018
Oracle 12.1.0.2 32-bit Database Client Installation crash on Windows 64-bit
1. Open registry
2. Go to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node
3. Create a new key with name Oracle
4. Go to Oracle and then create a new String Value with name inst_loc
5. Give the value as C:\Program Files (x86)\Oracle\Inventory
6. Retry installation
oracle  database  client  install  setup  32bit  64bit  crash  error 
june 2018
How to disable (turn off) the default Windows 2012 Administrator Complexity
1. Open the Administrative Tool
2. This places you in the Administrative Tools section. Select Local Security Policy.
3. Change the password Must Meet Complex Requirements option to Disabled.
microsoft  windows  admin  config  password  policy 
june 2018
How To Set Password Policies In Linux
- DEB based systems
/etc/pam.d/common-password

- RPM based systems
++ In RHEL, CentOS, Scientific Linux 7.x
/etc/security/pwquality.conf

++ In RHEL, CentOS, Scientific Linux 6.x
/etc/pam.d/system-auth
oracle  linux  config  admin  password  policy 
june 2018
CredSSP encryption oracle remediation
If you can't update your servers since it requires a reboot, you could add this to your clients Registry, send it out via GPO and all it takes is that the clients get an reboot:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\CredSSP\Parameters] "AllowEncryptionOracle"=dword:00000002
microsoft  windows  terminalserver  mstsc  credssp  fix 
may 2018
Linkers and connectors
In spite of / despite [a pesar de]
On one hand / on the other hand [por un lado... por el otro lado]
Due to [debido a]
Therefore [por lo tanto, por eso, luego]
Nevertheless [sin embargo]
As well as [además de]
For instance [por ejemplo]
Whereas [mientras que]
So [así que, por lo que]
english  gram  linkers  connectors 
april 2018
Como usar los comandos TASKLIST y TASKKILL en Windows
TASKLIST /V
Muestra información detallada de cada tarea ejecutándose.
TASKLIST /SVC
Muestra información adicional de los servicios hospedados en cada proceso.
TASKLIST /M modulo
Muestra todas las tareas que usan un módulo DLL o EXE especificado. Si no se indica el modulo se muestran todos los módulos cargados.
TASKLIST /FO formato
Especifica el formato de salida. Puede ser: "TABLE", "LIST", "CSV".
TASKLIST /NH
Si se usan los formatos "TABLE" y "CSV", especifica que el "encabezado de columna" no se debe mostrar.
TASKLIST /FI filtro
Filtra la información que se solicita con un criterio especificado.

TASKKILL /PID identidadproceso
Detiene un proceso especificando el número de identidad. Este puede conocerse usando TASKLIST.
TASKKILL /IM nombreTarea
Detiene un proceso especificando su nombre.
TASKKILL /FI filtro
Permite usar un filtro para seleccionar varias tareas al mismo tiempo.
TASKKILL /T
Termina un proceso y todos los procesos secundarios iniciados por él.
TASKKILL /F
Especifica que se debe terminar un proceso de forma forzada.
microsft  windows  shell  process  task 
april 2018
How To Convert a GPT Disk Back to an MS DOS type MBR Label
sudo parted /dev/sdu
GNU Parted 3.1
Using /dev/sdu
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mktable
New disk label type? msdos
Warning: The existing disk label on /dev/sdu will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes
(parted) quit
linux  parted  config  disk  msdos  gpt  mbr  label 
april 2018
Data Guard Queries
--Standby database process status: You can run following query on standby database to see what MRP and RFS processes are doing, which block of which archivelog sequences are being shipped or being applied.
select process, status, thread#, sequence#, block#, blocks from v$managed_standby ;
--Last applied log: Run this query on the standby database to see the last applied archivelog sequence number for each thread.
SELECT thread#, max(SEQUENCE#) FROM V$ARCHIVED_LOG where APPLIED='YES' group by thread#;
--Archivelog difference: Run this on primary database. (not for real time apply)
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
SELECT a.thread#, b. last_seq, a.applied_seq, a. last_app_timestamp, b.last_seq-a.applied_seq ARC_DIFF FROM (SELECT thread#, MAX(sequence#) applied_seq, MAX(next_time) last_app_timestamp FROM gv$archived_log WHERE applied = 'YES' GROUP BY thread#) a, (SELECT thread#, MAX (sequence#) last_seq FROM gv$archived_log GROUP BY thread#) b WHERE a.thread# = b.thread#;
--Apply/transport lags: v$dataguard_stats view will show the general synchronization status of standby database. Better to use on 11gR2 even with the latest PSU (Check bugs : 13394040, 7119382, 9968073, 7507011, 13045332, 6874522).
set lines 200
col name format a40
col value format a20
select * from v$dataguard_stats;
--Apply rate: To find out the speed of media recovery in a standby database, you can use this query:
set lines 200
col type format a30
col ITEM format a20
col comments format a20
select * from v$recovery_progress;
--You can also use below before 11gR2. (Deprecated in 11gR2):
select APPLY_RATE from V$STANDBY_APPLY_SNAPSHOT;
--To check Redo apply mode on physical standby database:
SELECT RECOVERY_MODE FROM V$ARCHIVE_DEST_STATUS where dest_id=2;
--To check what MRP process is waiting:
select a.event, a.wait_time, a.seconds_in_wait from gv$session_wait a, gv$session b where a.sid=b.sid and b.sid=(select SID from v$session where PADDR=(select PADDR from v$bgprocess where NAME='MRP0'))
--Archive Lag Histogram: The V$STANDBY_EVENT_HISTOGRAM view came with 11gR2 and shows the historical occurance of archive lags in terms of seconds. For example following output shows that in 07/01/2013 archive lag reached 5 hours and in 06/15/2013 gap was 22 hours which was resolved after more than a week.
col name format a10
select * from V$STANDBY_EVENT_HISTOGRAM;
--Redo switch report of primary database can be seen with the following query. This information may be helpful when investigating the possible causes of archive gaps, apply lags or data guard performance issues.
SET PAGESIZE 9999
col day format a15
SELECT A.*, Round(A.Count#*B.AVG#/1024/1024) Daily_Avg_Mb FROM(SELECT To_Char(First_Time,'YYYY-MM-DD') DAY, Count(1) Count#, Min(RECID) Min#, Max(RECID) Max# FROM gv$log_history GROUP BY To_Char(First_Time,'YYYY-MM-DD') ORDER BY 1 DESC) A,(SELECT Avg(BYTES) AVG#, Count(1) Count#, Max(BYTES) Max_Bytes, Min(BYTES) Min_Bytes FROM gv$log ) B;

--The last one is a shell command and lists the archive log apply records of standby database alert log with the corresponding times at the end of the line. This is useful to see a clean picture of redo apply status on the standby database.
tail -10000 /u01/app/oracle/product/diag/rdbms/testdb/TESTDB/trace/alert_TESTDB.log |awk -v x="" '{if (index($0,"Media Recovery Log ")!=0) print $0" "x; else if($1=="Mon"||$1=="Tue"||$1=="Wed"||$1=="Thu"||$1=="Fri"||$1=="Sat"||$1=="Sun") x=$0}'
oracle  database  dataguard  status  check  query 
march 2018
HOW TO QUERY DATAGUARD STATUS
--Issue the following query to show information about the protection mode, the protection level, the role of the database, and switchover status:
SELECT DATABASE_ROLE, DB_UNIQUE_NAME INSTANCE, OPEN_MODE, PROTECTION_MODE, PROTECTION_LEVEL, SWITCHOVER_STATUS FROM V$DATABASE;
--On the standby database, query the V$ARCHIVED_LOG view to identify existing files in the archived redo log.
SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
--Or
SELECT THREAD#, MAX(SEQUENCE#) AS "LAST_APPLIED_LOG" FROM V$LOG_HISTORY GROUP BY THREAD#;
--On the standby database, query the V$ARCHIVED_LOG view to verify the archived redo log files were applied.
SELECT SEQUENCE#,APPLIED FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
--Query the physical standby database to monitor Redo Apply and redo transport services activity at the standby site.
SELECT PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;
--To determine if real-time apply is enabled, query the RECOVERY_MODE column of the V$ARCHIVE_DEST_STATUS view.
SELECT RECOVERY_MODE FROM V$ARCHIVE_DEST_STATUS;
--The V$DATAGUARD_STATUS fixed view displays events that would typically be triggered by any message to the alert log or server process trace files.
SELECT MESSAGE FROM V$DATAGUARD_STATUS;
--Determining Which Log Files Were Not Received by the Standby Site.
SELECT LOCAL.THREAD#, LOCAL.SEQUENCE# FROM (SELECT THREAD#, SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=1) LOCAL WHERE LOCAL.SEQUENCE# NOT IN (SELECT SEQUENCE# FROM V$ARCHIVED_LOG WHERE DEST_ID=2 AND THREAD# = LOCAL.THREAD#);
--If a delayed apply has been specified or an archive log is missing then switchover may take longer than expected.--Check v$managed_standby
select process, status, sequence# from v$managed_standby;
--OR alternatively:
select name, applied from v$archived_log;
oracle  database  dataguard  status  check  query 
march 2018
How to log X-Forwarded-For in weblogic's access log?
Open your Weblogic administration console, go to Environment->Servers->[your server]->Logging->HTTP->Advanced

There, change Format to "Extended", and in Extended Logging Format Fields add cs(X-Forwarded-For)
oracle  weblogic  config  http  client  ip  x-forwarded-for 
march 2018
PowerShell: Test Domain User Account Credentials
<#
.SYNOPSIS
Test domain username/password combination are correct
.DESCRIPTION
This script will check if the password for a given username is correct. If the authentication failed using the provided Domain\Username and Password.
The script will do some checks and provide some clues why the authentication failed.
The checks are:
* Domain is reachable.
* User Name exists in the domain.
* The account is Enabled.
* The account is Unlocked.
.EXAMPLE
.\Test-UserCredentials.ps1
or
Right click the script and select "Run with PowerShell"
.Notes
Created by: Ibrahim Soliman
Version: 1.6 (Enhanced error handling, and authentication failure root cause analysis.)
Script blog post: http://wp.me/pOTjD-7Q
#>

#Import Active Directory Module
Import-Module Activedirectory

#Clear User Info Function
Function ClearUserInfo
{
$Cred = $Null
$DomainNetBIOS = $Null
$UserName = $Null
$Password = $Null
}

#Rerun The Script Function
Function Rerun
{
$Title = "Test Another Credentials?"
$Message = "Do you want to Test Another Credentials?"
$Yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Test Another Credentials."
$No = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "End Script."
$Options = [System.Management.Automation.Host.ChoiceDescription[]]($Yes, $No)
$Result = $host.ui.PromptForChoice($Title, $Message, $Options, 0)

Switch ($Result)
{
0 {TestUserCredentials}
1 {"End Script."}
}
}

#Test User Credentials Function
Function TestUserCredentials
{
ClearUserInfo
#Get user credentials
$Cred = Get-Credential -Message "Enter Your Credentials (Domain\Username)"
if ($Cred -eq $Null)
{
Write-Host "Please enter your username in the form of Domain\UserName and try again" -BackgroundColor Black -ForegroundColor Yellow
Rerun
Break
}

#Parse provided user credentials
$DomainNetBIOS = $Cred.username.Split("{\}")[0]
$UserName = $Cred.username.Split("{\}")[1]
$Password = $Cred.GetNetworkCredential().password

Write-Host "`n"
Write-Host "Checking Credentials for $DomainNetBIOS\$UserName" -BackgroundColor Black -ForegroundColor White
Write-Host "***************************************"

If ($DomainNetBIOS -eq $Null -or $UserName -eq $Null)
{
Write-Host "Please enter your username in the form of Domain\UserName and try again" -BackgroundColor Black -ForegroundColor Yellow
Rerun
Break
}
# Checks if the domain in question is reachable, and get the domain FQDN.
Try
{
$DomainFQDN = (Get-ADDomain $DomainNetBIOS).DNSRoot
}
Catch
{
Write-Host "Error: Domain was not found: " $_.Exception.Message -BackgroundColor Black -ForegroundColor Red
Write-Host "Please make sure the domain NetBios name is correct, and is reachable from this computer" -BackgroundColor Black -ForegroundColor Red
Rerun
Break
}

#Checks user credentials against the domain
$DomainObj = "LDAP://" + $DomainFQDN
$DomainBind = New-Object System.DirectoryServices.DirectoryEntry($DomainObj,$UserName,$Password)
$DomainName = $DomainBind.distinguishedName

If ($DomainName -eq $Null)
{
Write-Host "Domain $DomainFQDN was found: True" -BackgroundColor Black -ForegroundColor Green

$UserExist = Get-ADUser -Server $DomainFQDN -Properties LockedOut -Filter {sAMAccountName -eq $UserName}
If ($UserExist -eq $Null)
{
Write-Host "Error: Username $Username does not exist in $DomainFQDN Domain." -BackgroundColor Black -ForegroundColor Red
Rerun
Break
}
Else
{
Write-Host "User exists in the domain: True" -BackgroundColor Black -ForegroundColor Green


If ($UserExist.Enabled -eq "True")
{
Write-Host "User Enabled: "$UserExist.Enabled -BackgroundColor Black -ForegroundColor Green
}

Else
{
Write-Host "User Enabled: "$UserExist.Enabled -BackgroundColor Black -ForegroundColor RED
Write-Host "Enable the user account in Active Directory, Then check again" -BackgroundColor Black -ForegroundColor RED
Rerun
Break
}

If ($UserExist.LockedOut -eq "True")
{
Write-Host "User Locked: " $UserExist.LockedOut -BackgroundColor Black -ForegroundColor Red
Write-Host "Unlock the User Account in Active Directory, Then check again..." -BackgroundColor Black -ForegroundColor RED
Rerun
Break
}
Else
{
Write-Host "User Locked: " $UserExist.LockedOut -BackgroundColor Black -ForegroundColor Green
}
}

Write-Host "Authentication failed for $DomainNetBIOS\$UserName with the provided password." -BackgroundColor Black -ForegroundColor Red
Write-Host "Please confirm the password, and try again..." -BackgroundColor Black -ForegroundColor Red
Rerun
Break
}

Else
{
Write-Host "SUCCESS: The account $Username successfully authenticated against the domain: $DomainFQDN" -BackgroundColor Black -ForegroundColor Green
Rerun
Break
}
}

TestUserCredentials
ClearUserInfo
ldap 
february 2018
Using PowerShell to change timestamp of files and folders
Listing file and folder timestamps:
Get-ChildItem -force | Select-Object Mode, Name, CreationTime, LastAccessTime, LastWriteTime | ft -autosize

Changing Creation time of a folder:
(Get-Item "C:\mytest\myfolder1").CreationTime=("08 March 2016 18:00:00")

Changing modification time of a file:
(Get-Item "C:\mytest\myfile1.txt").LastWriteTime=("12 December 2016 14:00:00")

Changing access time of a file:
(Get-Item "C:\mytest\myfile2.txt").LastAccessTime=("10 December 2015 14:00:00")

Change timestamp of all files in current directory:
$files = Get-ChildItem -force | Where-Object {! $_.PSIsContainer}
foreach($object in $files)
{
$object.CreationTime=("10 November 2016 12:00:00")
}
microsoft  windows  powershell  date  timestamp  file  folder 
december 2017
Forzar el stop de un servicio en Windows
sc queryex <servicename>
taskkill /F /PID <PID>
net start <servicename>
 
sc qc <servicename>
microsoft  windows  services  stop 
december 2017
How to convert these julian da
select TO_DATE(TO_CHAR(115032+1900000),'YYYYDDD') jdedate from dual;
oracle  database  sql  date  julian 
december 2017
Windows Service
- Change the display name of service:
sc config "Old service name" displayname= "New service name"

- Change the executable you can run:
sc config "Service name" binpath= "C:\path\to\executa..."

- Delete a service:
sc delete "ServiceName"
microsoft  windows  admin  services  from notes
september 2017
expdp,impdp,include,exclude
SELECT named, object_path, comments FROM database_export_objects WHERE object_path NOT LIKE '%/%';
oracle  database  backup  config  export  import  expdp  impdp 
september 2017
How to edit iptables rules
#Mostrar reglas NAT

iptables -t nat --line-numbers -L

#Añadir reglas NAT

iptables -t nat -A PREROUTING -p tcp --dport 80 -i eth1 -j DNAT --to 10.10.59.214:8010
iptables -t nat -A PREROUTING -p tcp --dport 3000 -i eth1 -j DNAT --to 10.10.59.216:3000

#Borrar reglas NAT

iptables -t nat -D PREROUTING <num_regla>

#Hacer cambios persistentes

iptables-save > /etc/sysconfig/iptables
linux  admin  firewall  iptables 
september 2017
Check available entropy in Linux
# cat /proc/sys/kernel/random/entropy_avail

# yum install rng-utils
# yum install rng-tools

# rngd -r /dev/urandom -o /dev/random -b -t 1
linux  admin  security  ssl  entropy 
september 2017
Get user or object DDL using DBMS_METADATA
SELECT DBMS_METADATA.GET_DDL('USER',username) as script from DBA_USERS where username='&username'
UNION ALL
SELECT DBMS_METADATA.GET_GRANTED_DDL('SYSTEM_GRANT',grantee)as script from DBA_SYS_PRIVS where grantee='&username' and rownum=1
UNION ALL
SELECT DBMS_METADATA.GET_GRANTED_DDL('ROLE_GRANT',grantee)as script from DBA_ROLE_PRIVS where grantee='&username' and rownum=1
UNION ALL
SELECT DBMS_METADATA.GET_GRANTED_DDL('OBJECT_GRANT',grantee)as script from DBA_TAB_PRIVS where grantee='&username' and rownum=1
oracle  database  get  ddl  user  username  meta 
august 2017
Oracle Database Client 12102 32b (12c R2) installation crash off
BUG 20219460

Solution:
1 registry Open
2 to HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node Go
3 a Create new key with name Oracle
4 to Go Oracle and then create a new String Value with name inst_loc
5 the Give value as C:\Program Files\Oracle\Inventory (x86)
6 installation. Retry

[HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE]
inst_loc      C:\Program Files\Oracle\Inventory
 
I copied this path and put it into a new string value in this registry entry:
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ORACLE]
inst_loc      C:\Program Files\Oracle\Inventory
oracle  database  client  install  crash 
may 2017
Show the Bind Variable for a Given SQLID
--
-- Show the Bind Variable for a Given SQLID.
--

SET PAUSE ON
SET PAUSE 'Press Return to Continue'
SET PAGESIZE 60
SET LINESIZE 300

COLUMN sql_text FORMAT A120
COLUMN sql_id FORMAT A13
COLUMN bind_name FORMAT A10
COLUMN bind_value FORMAT A26

SELECT
sql_id,
t.sql_text sql_text,
b.name bind_name,
b.value_string bind_value
FROM
v$sql t
JOIN
v$sql_bind_capture b using (sql_id)
WHERE
b.value_string is not null
AND
sql_id='&sqlid'
/
oracle  database  sql  query  command  sqlid 
february 2017
Oracle dbms_metadata Tips
select 'select dbms_metadata.get_ddl(''TABLESPACE'','''
|| tablespace_name || ''') from dual;' from dba_tablespaces
oracle  database  sql  metadata  tablespace  ddl 
january 2017
Visualizing progression of file operations using pv (Pipe Viewer)
# tar -cpSvf - yourfilename.test | pv -s $(du -sb . | cut -f1) | gzip > /home/prueba/prueba.tar.gz
oracle  linux  command  file  compress  pv  tar  gzip 
december 2016
List of VMware Default Usernames and Passwords
vCenter vSphere Web Client Access
https://IPorDNS_of_Server:9443/vsphere-client/
username: root
password: vmware
For vSphere 5.1  = Windows default username: admin@System-Domain
For vSphere 5.1 = Linux (Virtual Appliance) default username: root@System-Domain
For vSphere 5.5 = default username: administrator@vsphere.local
vmware  vsphere  admin  username  password  default 
december 2016
xming : Client 4 rejected from IP
If you are getting following error in xming log:
Xming.exe: client 4 rejected from IP XXX.XXX.XXX.XXX

Secure method: Edit: X0.hosts (in the installation directory) and add the ip you want allow. e.g.

1 localhost
2 XXX.XXX.XXX.XXX

Restart Xming.
unix  xming  admin  config  display  x 
november 2016
SSL Verification fails on starting instances
https://romilbhagat.blogspot.com.es/2010/06/changing-hostnameip-for-weblogic-11g.html

export CLASSPATH=$CLASSPATH:/u01/oracle/middleware/oracle_home/wlserver/server/lib/weblogic.jar

--Set the PATH
$WL_HOME/server/bin/setWLSEnv.sh

--Backup DemoIdentity.jks under $WL_HOME/server/lib

java utils.CertGen -cn <localhost> -keyfilepass DemoIdentityPassPhrase -certfile newcert -keyfile newkey

java utils.ImportPrivateKey -keystore DemoIdentity.jks -storepass DemoIdentityKeyStorePassPhrase -keyfile newkey.pem -keyfilepass DemoIdentityPassPhrase -certfile newcert.pem -alias demoidentity
oracle  weblogic  nodemanager  admin  config  hostname 
september 2016
Script all indexes as CREATE INDEX statements
SELECT
REPLICATE(' ',4000) AS COLNAMES ,
OBJECT_NAME(I.ID) AS TABLENAME,
I.ID AS TABLEID,
I.INDID AS INDEXID,
I.NAME AS INDEXNAME,
I.STATUS,
INDEXPROPERTY (I.ID,I.NAME,'ISUNIQUE') AS ISUNIQUE,
INDEXPROPERTY (I.ID,I.NAME,'ISCLUSTERED') AS ISCLUSTERED,
INDEXPROPERTY (I.ID,I.NAME,'INDEXFILLFACTOR') AS INDEXFILLFACTOR
INTO #TMP
FROM SYSINDEXES I
WHERE I.INDID > 0
AND I.INDID < 255
AND (I.STATUS & 64)=0
--uncomment below to eliminate PK or UNIQUE indexes;
--what i call 'normal' indexes
--AND INDEXPROPERTY (I.ID,I.NAME,'ISUNIQUE') =0
--AND INDEXPROPERTY (I.ID,I.NAME,'ISCLUSTERED') =0

DECLARE
@ISQL VARCHAR(4000),
@TABLEID INT,
@INDEXID INT,
@MAXTABLELENGTH INT,
@MAXINDEXLENGTH INT
--USED FOR FORMATTING ONLY
SELECT @MAXTABLELENGTH=MAX(LEN(TABLENAME)) FROM #TMP
SELECT @MAXINDEXLENGTH=MAX(LEN(INDEXNAME)) FROM #TMP

DECLARE C1 CURSOR FOR
SELECT TABLEID,INDEXID FROM #TMP
OPEN C1
FETCH NEXT FROM C1 INTO @TABLEID,@INDEXID
WHILE @@FETCH_STATUS <> -1
BEGIN
SET @ISQL = ''
SELECT @ISQL=@ISQL + ISNULL(SYSCOLUMNS.NAME,'') + ',' FROM SYSINDEXES I
INNER JOIN SYSINDEXKEYS ON I.ID=SYSINDEXKEYS.ID AND I.INDID=SYSINDEXKEYS.INDID
INNER JOIN SYSCOLUMNS ON SYSINDEXKEYS.ID=SYSCOLUMNS.ID AND SYSINDEXKEYS.COLID=SYSCOLUMNS.COLID
WHERE I.INDID > 0
AND I.INDID < 255
AND (I.STATUS & 64)=0
AND I.ID=@TABLEID AND I.INDID=@INDEXID
ORDER BY SYSCOLUMNS.COLID
UPDATE #TMP SET COLNAMES=@ISQL WHERE TABLEID=@TABLEID AND INDEXID=@INDEXID

FETCH NEXT FROM C1 INTO @TABLEID,@INDEXID
END
CLOSE C1
DEALLOCATE C1
--AT THIS POINT, THE 'COLNAMES' COLUMN HAS A TRAILING COMMA
UPDATE #TMP SET COLNAMES=LEFT(COLNAMES,LEN(COLNAMES) -1)

SELECT 'CREATE '
+ CASE WHEN ISUNIQUE = 1 THEN ' UNIQUE ' ELSE ' ' END
+ CASE WHEN ISCLUSTERED = 1 THEN ' CLUSTERED ' ELSE ' ' END
+ ' INDEX [' + UPPER(INDEXNAME) + ']'
+ SPACE(@MAXINDEXLENGTH - LEN(INDEXNAME))
+' ON [' + UPPER(TABLENAME) + '] '
+ SPACE(@MAXTABLELENGTH - LEN(TABLENAME))
+ '(' + UPPER(COLNAMES) + ')'
+ CASE WHEN INDEXFILLFACTOR = 0 THEN '' ELSE ' WITH FILLFACTOR = ' + CONVERT(VARCHAR(10),INDEXFILLFACTOR) END --AS SQL
FROM #TMP

--SELECT * FROM #TMP
DROP TABLE #TMP
microsoft  sqlserver  query  select  index  ddl 
august 2016
Working with the bcp Command-line Utility
------------------------
--Export table to file--
------------------------
bcp JDE_PRODUCTION.PRODDTA.F4311 OUT c:\Users\ixt8515\PRODDTA_F4311_20160801.bcp -n -SNLDAMSDBCSQL04\NLDAMSJDEINS02 -Usa

------------------------
--Import file to table--
------------------------
bcp JDE_CRP.CRPDTA.F4311 IN c:\Users\ixt8515\PRODDTA_F4311_20160801.bcp -n -SNLDAMSDBCSQL04\NLDAMSJDEINS02 -Usa
microsoft  sqlserver  export  import  data  bcp  app 
august 2016
Decrypt the Passwords in Weblogic
-Below steps can be followed to Decrypt the Passwords in Weblogic.

source $DOMAIN_HOME/bin/setDomainEnv.sh
cd $DOMAIN_HOME/security

-Please create a file called plainpassword.py with the below contents and save the file

from weblogic.security.internal import *
from weblogic.security.internal.encryption import *

encryptionService = SerializedSystemIni.getEncryptionService(".")
clearOrEncryptService = ClearOrEncryptedService(encryptionService)

passwd = raw_input("Enter encrypted password of one which you wanted to decrypt : ")

plainpwd = passwd.replace("\\", "")

print "Plain Text password is: " + clearOrEncryptService.decrypt(plainpwd)

-Run the below command to decrypting the password. Enter the encrypted password when prompted

"java weblogic.WLST plainpassword.py
Initializing WebLogic Scripting Tool (WLST) ...
Welcome to WebLogic Server Administration Scripting Shell
Type help() for help on available commands
Enter encrypted password of one which you wanted to decrypt : {AES}LsGaddassssvQDyibmejXFkf1tWxyndNArAhZ3M5GcnjXWUpJs=
Plain Text password is: Welcome1234"

-Using this way we can decrypt the encrypted password from boot.propertis and db schema passwords stored data source xml files on $DOMAIN_HOME/config/jdbc and also we can decrypt the NM password which is on config.xml.
oracle  weblogic  admin  password  decrypt 
august 2016
Using REPLACE in an UPDATE statement
SELECT Replace('SQLTeam.com Rocks!', 'Rocks', 'Rolls')

will return:

SQLTeam.com Rolls!
microsoft  sqlserver  query  update  replace 
july 2016
Remote access to CUPS admin interface
# Listen on all interfaces
Port 631
Listen /var/run/cups/cups.sock
linux  printer  cups  howto  admin 
june 2016
Command-Line Printing and Options
CUPS provides both the System V (lp(1)) and Berkeley (lpr(1)) printing commands for printing files. In addition, it supported a large number of standard and printer-specific options that allow you to control how and where files are printed.
linux  printer  howto  admin  command 
june 2016
Information Schema Views (Transact-SQL)
SELECT TABLE_NAME
FROM JDE_PRODUCTION.INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME LIKE '%TEMP' GROUP BY TABLE_NAME;
GO
microsoft  sqlserver 
june 2016
How to extract DDL for all Tablespaces
set head off echo off
select 'select dbms_metadata.get_ddl(''TABLESPACE'','''
|| tablespace_name || ''') from dual;' from dba_tablespaces
oracle  database  get  tablespace  datafile  ddl 
june 2016
Create a 100MB file for testing transfer speed
dd if=/dev/zero of=bigfile bs=1024 count=102400
linux  admin  create  null  file 
june 2016
vsftpd: Transfer Done (but failed to open directory)
1.Using a command-line, goto /etc/selinux/
2.Open the file config using your prefered text editor (e.g. vim, nano)
3.Find the option SELINUX= and set it to the following:
SELINUX=disabled
4.Save the file and reboot you machine.
linux  admin  selinux  vsftpd  ftp  dir 
june 2016
Delete Files Older Than x Days on Linux
find /path/to/files* -mtime +5 -exec rm {} \;
/usr/bin/find /home/oracle/files -mtime +30 -type f -print -exec rm {} \;
linux  command  find  delete  purge  date 
may 2016
Oracle/PLSQL: Subqueries
SELECT * FROM ALL_TABLES T1 WHERE T1.OWNER='PRODDTA' AND T1.TABLE_NAME NOT IN (SELECT T2.TABLE_NAME FROM ALL_CONSTRAINTS T2 WHERE T1.TABLE_NAME=T2.TABLE_NAME);
oracle  database  sql  plsql  subquery 
april 2016
CUPS web config 403 Forbidden
/etc/cups/cupsd.conf

In the blocks: <Location /> , <Location /admin> and <Location /admin/conf>
Add: Allow all
linux  cups  howto  admin  printer 
april 2016
2 Methods To Change TimeZone in Linux
https://unix.stackexchange.com/questions/110522/timezone-setting-in-linux

# unlink /etc/localtime
# ln -s /usr/share/zoneinfo/US/Pacific /etc/localtime
# date
linux  howto  base  admin  date  time  timezone 
april 2016
How to find duplicates based on two fields?
SELECT *
FROM (
SELECT t.*, ROW_NUMBER() OVER (PARTITION BY station_id, obs_year ORDER BY entity_id) AS rn
FROM mytable t
)
WHERE rn > 1
oracle  database  sql 
april 2016
Unable to start weblogic with nodemanager (state force shutting down)
I had a managed weblogic server 12c with state force shutting down. The server was shutdown but for some reason the state was still force shutting down. It was possible to start/stop the server using start-up scripts but not with node manager. Admin console says that server is in incompatible state when try to start it.

I investigate the logs and could not find any clue. But after inspecting the folders on the file system i found the file that nodemanager holds the state of managed server. I remove the file and server start again with nodemanager without problems. The file was in:

<domain_home>/servers/<managed_server_name>/data/nodemanager/<managed_server_name>.state
oracle  middleware  weblogic  start  stop  state 
april 2016
Users Prompted to Download, Run, Open Launch.ica File, Instead of Launching Connection
Symptoms or Error:

When launching an application from the Internet browser, users are prompted to save or download the launch.ica file. The prompt Do you want to Open, Save, or Cancel the launch.ica connection file is displayed.The application does not launch immediately. Also, some but not all the users report that they are unable to connect.
vpn  citrix  receiver  launch  problem 
april 2016
« earlier      
32bit 64bit active activex admin app appliance asm backup base bcp certificate certification character check cisco citrix client cnc command compress config connectors crash create credssp crontab cups cygwin data database datafile dataguard datapump date ddl declaración decrypt default delete demotrust deploy dir disk diskgroup display drive drop e1 engineered_systems english entropy error esx exam excel expdp export faq fdisk file find firewall fix folder free ftp get gob gpt gram grid gzip hostname hotfix howto http ie impdp import index install ip iptables irpf issue java jdedwards julian key keyboard keystore label language launch ldap linkers linux login map mbr mediaobject meta metadata microsft microsoft middleware mobj msdos mstsc nfs nodemanager null oda openssh options ora-01000 oracle override ovf ovftool parameters parted passive password patch path plsql policy powershell ppk printer private problem process processing public purge puttygen pv query receiver recover redolog renta replace reset rman rosseta scheduler script security select selinux server services set setup shell shrewsoft sql sqldeveloper sqlid sqlserver ssh ssl start state status stone stop structure subquery superuser support table tablespace tar task terminalserver time timestamp timezone tns troubleshooting undo undotbs unix update user username veeam vm vmware vpn vsftpd vsphere web weblogic windows x x-forwarded-for xming

Copy this bookmark:



description:


tags: