Today when i trying to connect to our development database on linux server with root user, but i forget the correct password. :) because i was logging after a 10 months. after that i need to reset root password and this is the following step.
linux machine :
Red Hat Enterprise Linux AS release 4 (Nahant Update 3)
and grub loader.
step.
1. reboot machine
2. wait for GRUB splash screen appear
3. then click on "e" keyword in keyboard (hit enter)
4. after that another window will open again click on "e" keyword in keyword to select "KERNAL ... " from list of value. (hit enter)
5. then type "single" included space (hit enter)
6. then type "b" from keyboard to boot (hit enter)
7. system boot up as single user mode
8. you will see # prompt , here type "passwd" command to change root password
9. reboot
10. enjoy to logging with new user
Search This Blog
Wednesday, December 7, 2011
Friday, November 4, 2011
How to Get the Locked Tables List In Oracle
Get the Locked Tables List
This will give you queries currently running for more than 60 seconds. Note that it prints multiple lines per running query if the SQL has multiple lines. Look at the sid,serial# to see what belongs together.
And to get the details of a particular session given by the sid in the above query use this querySELECT l.inst_id,SUBSTR (L.ORACLE_USERNAME, 1, 8) ORA_USER,SUBSTR (L.SESSION_ID, 1, 3) SID, S.serial#,SUBSTR (O.OWNER || '.' || O.OBJECT_NAME, 1, 40) OBJECT,P.SPID OS_PID,DECODE (L.LOCKED_MODE,0, 'NONE',1, 'NULL',2, 'ROW SHARE',3, 'ROW EXCLUSIVE',4, 'SHARE',5, 'SHARE ROW EXCLUSIVE',6, 'EXCLUSIVE',NULL)LOCK_MODEFROM sys.GV_$LOCKED_OBJECT L,DBA_OBJECTS O,sys.GV_$SESSION S,sys.GV_$PROCESS PWHERE L.OBJECT_ID = O.OBJECT_IDAND l.inst_id = s.inst_idAND L.SESSION_ID = S.SIDAND s.inst_id = p.inst_idAND S.PADDR = P.ADDR(+)ORDER BY l.inst_id;
select STATUS , PROCESS , PROGRAM , LOGON_TIME from v$session where sid=
This will give you queries currently running for more than 60 seconds. Note that it prints multiple lines per running query if the SQL has multiple lines. Look at the sid,serial# to see what belongs together.
SELECT s.username,s.sid,s.serial#,s.last_call_et / 60 mins_running,q.sql_textFROM v$session sJOIN v$sqltext_with_newlines q ON s.sql_address = q.addressWHERE status = 'ACTIVE' AND TYPE <> 'BACKGROUND' AND last_call_et > 60ORDER BY sid, serial#, q.piece
Tuesday, November 1, 2011
Setting ORACLE DB into noarchivelog mode
Steps when the database state is down:
1. Login to sqlplus
2. The db must be mounted EXCLUSIVE and not open for operation
3. Check the log mode status of the database
4. Setting it to noarchivelog mode
5. Setting db open for user operation
6. Reverting back to archivelog mode
1. Login to sqlplus
- sqlplus /nolog
- connect / as sysdba2. The db must be mounted EXCLUSIVE and not open for operation
- startup mount;3. Check the log mode status of the database
- select log_mode from v$database;4. Setting it to noarchivelog mode
- alter database noarchivelog;5. Setting db open for user operation
- alter database open;6. Reverting back to archivelog mode
- alter database archivelog;
Labels:
archivelog mode,
noarchivelog mode
Friday, October 21, 2011
Configuration NFS (Network File System)
Server side 10.10.10.10
# cat /etc/exports
/d01/backup 10.10.10.20(ro)
# cat /etc/hosts.deny
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
# cat /etc/hosts.allow
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
portmap: 10.10.10.20
lockd: 10.10.10.20
rquotad: 10.10.10.20
mountd: 10.10.10.20
statd: 10.10.10.20
# cd /sbin/
# portmap
# cd /usr/sbin/
# rpc.mountd
# rpc.nfsd
# rpc.statd
# rpc.lockd
# rpc.rquotad
# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 657 mountd
100005 1 tcp 660 mountd
100005 2 udp 657 mountd
100005 2 tcp 660 mountd
100005 3 udp 657 mountd
100005 3 tcp 660 mountd
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 35144 nlockmgr
100021 3 udp 35144 nlockmgr
100021 4 udp 35144 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 34377 nlockmgr
100021 3 tcp 34377 nlockmgr
100021 4 tcp 34377 nlockmgr
100024 1 udp 801 status
100024 1 tcp 804 status
100011 1 udp 804 rquotad
100011 2 udp 804 rquotad
100011 1 tcp 807 rquotad
100011 2 tcp 807 rquotad
# exportfs -ra
Client side 10.10.10.20
# cd /sbin/
# portmap
# service portmap status
# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100021 1 udp 61494 nlockmgr
100021 3 udp 61494 nlockmgr
100021 4 udp 61494 nlockmgr
100021 1 tcp 53241 nlockmgr
100021 3 tcp 53241 nlockmgr
100021 4 tcp 53241 nlockmgr
# mount 10.10.10.10:/d01/backup /d01/backup
# cat /etc/exports
/d01/backup 10.10.10.20(ro)
# cat /etc/hosts.deny
#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!
portmap:ALL
lockd:ALL
mountd:ALL
rquotad:ALL
statd:ALL
# cat /etc/hosts.allow
#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
portmap: 10.10.10.20
lockd: 10.10.10.20
rquotad: 10.10.10.20
mountd: 10.10.10.20
statd: 10.10.10.20
# cd /sbin/
# portmap
# cd /usr/sbin/
# rpc.mountd
# rpc.nfsd
# rpc.statd
# rpc.lockd
# rpc.rquotad
# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100005 1 udp 657 mountd
100005 1 tcp 660 mountd
100005 2 udp 657 mountd
100005 2 tcp 660 mountd
100005 3 udp 657 mountd
100005 3 tcp 660 mountd
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100021 1 udp 35144 nlockmgr
100021 3 udp 35144 nlockmgr
100021 4 udp 35144 nlockmgr
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 tcp 34377 nlockmgr
100021 3 tcp 34377 nlockmgr
100021 4 tcp 34377 nlockmgr
100024 1 udp 801 status
100024 1 tcp 804 status
100011 1 udp 804 rquotad
100011 2 udp 804 rquotad
100011 1 tcp 807 rquotad
100011 2 tcp 807 rquotad
# exportfs -ra
Client side 10.10.10.20
# cd /sbin/
# portmap
# service portmap status
# rpcinfo -p
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100021 1 udp 61494 nlockmgr
100021 3 udp 61494 nlockmgr
100021 4 udp 61494 nlockmgr
100021 1 tcp 53241 nlockmgr
100021 3 tcp 53241 nlockmgr
100021 4 tcp 53241 nlockmgr
# mount 10.10.10.10:/d01/backup /d01/backup
Labels:
Network File System,
nfs,
setting up NFS
Monday, July 18, 2011
Chuyển đổi file Excel xls sang file csv vẫn giữ font tiếng Việt unicode
Mình có file dữ liệu là excel *.xls . Vì nhu cầu công việc mình cần phải chuyển nó sang file có định dạng *.csv để import vào một ứng dụng của công ty. Mặc dù trong Excel có chức năng Save As, chọn type là *.csv; nhưng Excel lại không hỗ trợ Unicode. Do đó file *.csv sau khi tạo bằng chức năng Save As của Excel bị mất font tiếng Việt.
Lên net tìm một một buổi chẳng có chỉ thấy ai làm được. Chỉ có cách của Anhgolden's Blog! . Nhưng cách này thì rườm rà, không hay.
Thế là mình quyết định viết một macro ngay trên Excel để chuyển font Unicode sang UTF8. Rồi sau đó dùng chức năng Save As của Excel để lưu ra file *.csv. Vì đặc tính của UTF8 là dùng nhiều ký tự 1byte để biểu diễn cho một ký tự Unicode nhiều bytes. Nên file *.csv tạo ra vẫn có tiếng Việt. Và có thể import vào ứng dụng của công ty. Hiện nay, hầu hết các ứng dụng đều hỗ trợ UTF8(nhưng Excel không hiễn thị được tiếng Việt UTF8 nhé).
Giờ thì chỉ mỗi việc mở file excel có macro (Link download) run macro để chuyển font Unicode sang UTF8, và Save As là có file *.csv với font Tiếng Việt. Bài viết giúp được bạn comment cảm ơn 1 tiếng nhé.
Dưới đây là demo:
Tuesday, May 10, 2011
MySQL my.cnf configuration for a large Drupal site
For a large web site with hundreds of thousands of page views per day, it is important to increase certain parameters, such as the query cache, join buffers, key buffer, ..etc.
The following my.cnf file is from an Ubuntu server (Debian derived) with dual CPUs, and 2 GB of RAM. It assumes that you are using MyISAM tables only and not InnoDB.
Depending on what modules you have, you may need to adjust some of those parameters, but this is definitely a good start.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
old_passwords = 1
bind-address = 127.0.0.1
key_buffer = 16M
key_buffer_size = 32M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
join_buffer_size = 512K
max_connections = 150
log_slow_queries = /var/log/mysql/mysql-slow.log
skip-bdb
skip-innodb
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
port = 3306
socket = /var/run/mysqld/mysqld.sock
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0
[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/english
skip-external-locking
old_passwords = 1
bind-address = 127.0.0.1
key_buffer = 16M
key_buffer_size = 32M
max_allowed_packet = 16M
thread_stack = 128K
thread_cache_size = 64
query_cache_limit = 8M
query_cache_size = 64M
query_cache_type = 1
join_buffer_size = 512K
max_connections = 150
log_slow_queries = /var/log/mysql/mysql-slow.log
skip-bdb
skip-innodb
[mysqldump]
quick
quote-names
max_allowed_packet = 16M
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
[isamchk]
key_buffer = 16M
Wednesday, April 27, 2011
Duplication Fails with Multiple RMAN-06023 Errors: Scenario
Duplication Fails with Multiple RMAN-06023 Errors: Scenario
In this scenario, you back up the database, then run the
DUPLICATE command. You receive the following error stack:RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of Duplicate Db command at 09/04/2001 13:55:11 RMAN-03015: error occurred in stored script Memory Script RMAN-06026: some targets not found - aborting restore RMAN-06023: no backup or copy of datafile 8 found to restore RMAN-06023: no backup or copy of datafile 7 found to restore RMAN-06023: no backup or copy of datafile 6 found to restore RMAN-06023: no backup or copy of datafile 5 found to restore RMAN-06023: no backup or copy of datafile 4 found to restore RMAN-06023: no backup or copy of datafile 3 found to restore RMAN-06023: no backup or copy of datafile 2 found to restore RMAN-06023: no backup or copy of datafile 1 found to restore
Duplication Fails with Multiple RMAN-06023 Errors: Diagnosis
The
DUPLICATE command recovers to archived redo logs, but cannot recover into online redo logs. Thus, if the restored backup cannot be made consistent without applying the online redo logs, then duplication fails with RMAN-06023 errors because RMAN is looking for backups created before the most recent archived log.Duplication Fails with Multiple RMAN-06023 Errors: Solution
After backing up the source database, archive and back up the current redo log:
RMAN> SQL 'ALTER SYSTEM ARCHIVE LOG CURRENT'; RMAN> BACKUP ARCHIVELOG ALL;
ref: Oracle® Database Backup and Recovery Advanced User's Guide
Subscribe to:
Posts (Atom)