2019-02-26

Some Programs Cannot Access Network Locations

Configure the EnableLinkedConnections registry value. This value enables Windows Vista and Windows 7 to share network connections between the filtered access token and the full administrator access token for a member of the Administrators group. After you configure this registry value, LSA checks whether there is another access token that is associated with the current user session if a network resource is mapped to an access token. If LSA determines that there is a linked access token, it adds the network share to the linked location.

To configure the EnableLinkedConnections registry value

  1. Click Start, type regedit in the Start programs and files box, and then press ENTER.
  2. Locate and then right-click the registry subkey HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System.
  3. Point to New, and then click DWORD Value.
  4. Type EnableLinkedConnections, and then press ENTER.
  5. Right-click EnableLinkedConnections, and then click Modify.
  6. In the Value data box, type 1, and then click OK.
  7. Exit Registry Editor, and then restart the computer.
Refer: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/ee844140(v=ws.10)

2018-07-13

ORA-02391: exceeded simultaneous SESSIONS_PER_USER limit

1. Check how many sessions were existed:

SELECT count(*) as connections, username 
FROM   v$session 
GROUP  BY username 

ORDER  BY username; 


2. Check SESSIONS_PER_USER for the user: (example username: THONY)

SELECT a.username, b.profile, b.resource_name, b.limit 
FROM dba_users a , dba_profiles b 
WHERE a.profile=b.profile AND b.resource_name='SESSIONS_PER_USER' AND a.username='THONY';


3. Alter SESSIONS_PER_USER value: (example profile: DEFAULT)

ALTER PROFILE default LIMIT SESSIONS_PER_USER 10;

2016-10-07

Windows 複製檔案時保留權限

xcopy c:\source_folder_name d:\destination_folder_name /E /H /K /O /X

    /E - Copies folders and subfolders, including empty ones.
    /H - Copies hidden and system files also.
    /K - Copies attributes. Typically, Xcopy resets read-only attributes.
    /O - Copies file ownership and ACL information.
    /X - Copies file audit settings (implies /O).

2016-06-08

STMP Relay Test

1. Telnet <HOSTNAME> <PORT NO>
2. mail from: <Sender Email Address>
3. rcpt to: <Receiver Email Address>
4.  data
5. FROM: <Sender Email Address>
6. Subject: <Email Subject>
7. <Email Content>
8. input "." to send

2016-01-19

Oracle SQL Developer Default Script Path


How to define the script path to run SQL via text file?

Tools --> Preferences --> Database --> Worksheet -->
Select default path to look for scripts



2015-02-13

檢查Windows網絡硬碟使用哪個帳戶登記

The following command for checking Windows network drive used which account to map

wmic netuse where LocalName="Z:" get UserName /value

2014-09-24

查找LINUX 版本, KERNEL 版本

Check the Linux Version, Release name and Kernel version

  • uname -a (Print all Information)
  • uname -r (Print the kernel name)
  • uname -m
  • cat /proc/version
  • cat /etc/issue
  • cat /etc/redhat-release
  • lsb_release –a
  • tail /etc/redhat-release

2014-07-10

[Solved] Access denied ("java.util.PropertyPermission" "user.timezone" "write")

解決 Access denied ("java.util.PropertyPermission" "user.timezone" "write") 問題

Edit $JAVA_HOME\lib\security\java.policy (Both Program File and Program File x86)


grant {
...  

    permission java.util.PropertyPermission "user.timezone", "write";
};

save as java.policy and then replace the original. 

Restart java.exe process

2014-07-09

取得資料夾和子資料夾的權限和路徑列表

Get the List of Sub Directories with Their Owner & Permissions & Full Paths

先以find -type d找出所有/var以內所有資料夾的路徑,然後再用ls -dl 列出

ls -dl `find /var -type d`

source: http://www.ducea.com/2009/06/05/linux-tips-get-the-list-of-subdirectories-with-their-owner-permissions-and-full-paths/

2014-04-24

Enable JMX on tomcat7 running as Windows service

  1. Start 'Tomcat Configure' --> 'Java' tab --> 'Java Options' text box --> Append the followings -Dcom.sun.management.jmxremote.port=8090 -Dcom.sun.management.jmxremote.authenticate=false-Dcom.sun.management.jmxremote.ssl=false

  2. Save, Exit and then restart the service
  3. Connect to the JMX console
  4. Start jconsole from your JDK installation location
    example: C:\java\jdk1.6.0_37\bin\jconsole.exe
  5. Click 'New Connection'
  6. Checked 'Remote Process'
  7. Enter hostname:8090

2013-07-25

Overiew of Oracle Sequences

在oracle中sequence就是所謂的序列號,每次取的時候它會自動增加,一般用在需要按序列號排序的地方。

1、Create Sequence
你首先要有CREATE SEQUENCE或者CREATE ANY SEQUENCE權限,
CREATE SEQUENCE emp_sequence
    INCREMENT BY 1  -- 每次加幾個
    START WITH 1    -- 從1開始計數
    NOMAXVALUE      -- 不設置最大值
    NOCYCLE         -- 一直累加,不循環
    CACHE 10;

一旦定義了emp_sequence,你就可以用CURRVAL,NEXTVAL
 CURRVAL=返回 sequence的當前值
 NEXTVAL=增加sequence的值,然返回 sequence 值
比如:
  emp_sequence.CURRVAL
  emp_sequence.NEXTVAL

可以使用sequence的地方:
- 不包含子查詢、snapshot、VIEW的 SELECT 語句
- INSERT語句的子查詢中
- NSERT語句的VALUES中
- UPDATE 的 SET中  

可以看如下例子:
INSERT INTO emp VALUES
(empseq.nextval, 'LEWIS', 'CLERK',7902, SYSDATE, 1200, NULL, 20);

SELECT empseq.currval     FROM DUAL;

但是要注意的是:
- 第一次NEXTVAL返回的是初始值;隨的NEXTVAL會自動增加你定義的INCREMENT BY值,然返回增加的值。CURRVAL 總是返回當前SEQUENCE的值,但是在第一次NEXTVAL初始化之才能使用CURRVAL,否則會出錯。一次NEXTVAL會增加一次SEQUENCE的值,所以如果你在同一個語句裡面使用多個NEXTVAL,其值就是不一樣的。

- 如果指定CACHE值,ORACLE就可以預先在內存裡面放置一些sequence,這樣存取的快些。cache裡面的取完,oracle自動再取一組到cache。 使用cache或許會跳號, 比如數據庫突然不正常down掉(shutdown abort),cache中的sequence就會丟失. 所以可以在create sequence的時候用nocache防止這種情況。

2、Alter Sequence
你或者是該sequence的owner,或者有ALTER ANY SEQUENCE 權限才能改動sequence. 可以alter除start至以外的所有sequence參數.如果想要改變start值,必須 drop  sequence 再 re-create .
Alter sequence 的例子
ALTER SEQUENCE emp_sequence
    INCREMENT BY 10
    MAXVALUE 10000
    CYCLE    -- 到10000從頭開始
    NOCACHE ;


影響Sequence的初始化參數:
SEQUENCE_CACHE_ENTRIES =設置能同時被cache的sequence數目。

可以很簡單的Drop Sequence
DROP SEQUENCE order_seq;

From: http://fanqiang.chinaunix.net/a2/b2/20010514/10150052_b.html

Review Who is Connected to Windows Shared Folder

  1. Open Computer Management Console     Windows Key + R -> compmgmt.msc      2. Expand System Tools -> Shared Folder -> Sessions ...