Pages

Subscribe Twitter Twitter

Wednesday, January 28, 2015

Oracle express failed to start


If you cannot start Orace express services (OracleXETNSListener and OracleServiceXE) after you changing your computer domain or computer name, try to modify two files as follows:

(1)listener.ora
(2)tnsnames.ora

in
%Oracle_Home%\app\oracle\product\10.2.0\server\NETWORK\ADMIN


Then , restart services. It is work.

Wednesday, October 27, 2010

How to count data group by week?

try this.
It's work on Oracle database.
select distinct trunc(s_time) - to_char(s_time,'d') week, count(*)
from xTABLE
group by trunc(s_time) - to_char(s_time,'d')
order by week

Monday, March 12, 2007

disable PAE mode

to modify boot.ini
[boot loader]
timeout=30
default=multi(0)disk(0)rdisk(0)partition(1)\WINDOWS
[operating systems]
multi(0)disk(0)rdisk(0)partition(1)\WINDOWS="Microsoft Windows XP Professional" /fastdetect /NoExecute=AlwaysOff

Wednesday, February 28, 2007

java date format

private String getToday(){
String strToday="";
Date date = new Date();
//Format formatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Format formatter = new SimpleDateFormat("yyyy_MM_dd_HH_mm"); 
strToday = formatter.format(date);
return strToday;
} 

Thursday, February 01, 2007

shrunk SQL Server transscation log

database name and log file name , ex: MYDB and MYDB_Log
SET NOCOUNT ON
DECLARE @LogicalFileName sysname,
@MaxMinutes INT,
@NewSize INT

-- *** MAKE SURE TO CHANGE THE NEXT 4 LINES WITH YOUR CRITERIA. ***
USE    MYDB              -- This is the name of the database
-- for which the log will be shrunk.
SELECT  @LogicalFileName = 'MYDB_Log',  -- Use sp_helpfile to
-- identify the logical file
-- name that you want to shrink.
@MaxMinutes = 10,      -- Limit on time allowed to wrap log.
@NewSize    = 10       -- in MB

-- Setup / initialize
DECLARE @OriginalSize int
SELECT @OriginalSize = size -- in 8K pages
FROM sysfiles
WHERE name = @LogicalFileName
SELECT 'Original Size of ' + db_name() + ' LOG is ' +
CONVERT(VARCHAR(30),@OriginalSize) + ' 8K pages or ' +
CONVERT(VARCHAR(30),(@OriginalSize*8/1024)) + 'MB'
FROM sysfiles
WHERE name = @LogicalFileName

CREATE TABLE DummyTrans
(DummyColumn char (8000) not null)

-- Wrap log and truncate it.
DECLARE @Counter   INT,
@StartTime DATETIME,
@TruncLog  VARCHAR(255)
SELECT  @StartTime = GETDATE(),
@TruncLog = 'BACKUP LOG ['+ db_name() + '] WITH TRUNCATE_ONLY'
-- Try an initial shrink.
DBCC SHRINKFILE (@LogicalFileName, @NewSize)

EXEC (@TruncLog)

-- Wrap the log if necessary.
WHILE     @MaxMinutes > DATEDIFF (mi, @StartTime, GETDATE()) -- time has not expired
AND @OriginalSize = (SELECT size FROM sysfiles WHERE name = @LogicalFileName)  -- the log has not shrunk
AND (@OriginalSize * 8 /1024) > @NewSize  -- The value passed in for new size is smaller than the current size.
BEGIN -- Outer loop.
SELECT @Counter = 0
WHILE  ((@Counter < @OriginalSize / 16) AND (@Counter < counter =" @Counter" name =" @LogicalFileName">

Saturday, June 17, 2006

[java] Read properties

Enumeration e =System.getProperties().propertyNames();
Object obj;        
while( e.hasMoreElements()){
    obj = e.nextElement();            
    System.out.println(obj + " = " + System.getProperty(obj.toString()));
}