oracleЧÀÍÆ÷Ãû³ÆÔõô²é
¿ÉÒÔʹÓÃÒÔÏÂÒªÁìÅÌÎÊ oracle ЧÀÍÆ÷Ãû³Æ£ºÊ¹Óà v$instance ÊÓͼʹÓà @@server_name º¯ÊýʹÓà serverproperty() º¯ÊýʹÓà hostname ÏÂÁlinux/unix£©Ê¹Óà gethostname() ÒªÁ죨java£©Ê¹Óà environment.machinename ÊôÐÔ£¨.net£©
ÔõÑùÅÌÎÊ Oracle ЧÀÍÆ÷Ãû³Æ
ÒªÅÌÎÊ Oracle ЧÀÍÆ÷Ãû³Æ£¬¿ÉÒÔʹÓÃÒÔÏÂÒªÁ죺
1. ʹÓà V$INSTANCE ÊÓͼ£º
SELECT name FROM v$instance;
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
2. ʹÓà @@Server_Name º¯Êý£º
SELECT @@Server_Name;
µÇ¼ºó¸´ÖÆ
3. ʹÓà SERVERPROPERTY() º¯Êý£º
SELECT SERVERPROPERTY('MachineName');
µÇ¼ºó¸´ÖÆ
4. ʹÓà hostname ÏÂÁLinux/Unix£©£º
hostname
µÇ¼ºó¸´ÖÆ
5. ʹÓà getHostName() ÒªÁ죨Java£©£º
import java.net.InetAddress; String hostname = InetAddress.getLocalHost().getHostName();
µÇ¼ºó¸´ÖÆ
6. ʹÓà Environment.MachineName ÊôÐÔ£¨.NET£©£º
string hostname = Environment.MachineName;
µÇ¼ºó¸´ÖÆ
ʾÀý£º
Ö´ÐÐÒÔÏÂÅÌÎÊÒÔ»ñÈ¡ Oracle ЧÀÍÆ÷Ãû³Æ£º
SELECT name FROM v$instance;
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
Êä³öЧ¹ûÀàËÆÓÚ£º
name ------- DB01
µÇ¼ºó¸´ÖÆ
ÕâÅúעЧÀÍÆ÷Ãû³ÆΪ “DB01″¡£
ÒÔÉϾÍÊÇoracleЧÀÍÆ÷Ãû³ÆÔõô²éµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡