Recent Notes

Displaying notes 31 - 40
Created by Dr. Xi on February 06, 2010 00:38:29    Last update: February 06, 2010 00:39:01
From Oracle doc: DBA_FREE_SPACE describes the free extents in all tablespaces in the database. Note that if a datafile (or entire tablespace) is offline in a locally managed tablespace, you will not see any extent information. If an object has extents in an online file of the tablespace, you will see extent information about the offline datafile. However, if the object is entirely in the offline file, a query of this view will not return any records. SQL> select tablespace_name, count(*) free_extends, sum(blocks) total_blocks 2 from dba_free_space 3 group by tablespace_name; TABLESPACE_NAME FREE_EXTENDS TOTAL_BLOCKS ------------------------------ ------------ ------------ SYSAUX 84 5616 USERS 1 12376 SYSTEM 2 904 UNDO 13 14016 SQL>
Created by Dr. Xi on February 06, 2010 00:25:00    Last update: February 06, 2010 00:26:50
Solution: grant unlimited tablespace to <user> or alter user <user_name> quota 250m on <tablespace_name> Example: SQL> create table customer ( 2 id number(9), 3 name varchar2(40)); create table customer ( * ERROR at line 1: ORA-01950: no privileges on tablespace 'SYSTEM' SQL> quit Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production C:\>sqlplus system@xe SQL*Plus: Release 10.1.0.5.0 - Production on Fri Feb 5 18:19:08 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. Enter password: Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production SQL> grant unlimited tablespace to jpa; Grant succeeded. SQL> quit Disconnected from Oracle Database 10g Express Edition Release 10.2.0.1.0 - Production C:\>sqlplus jpa@xe SQL*Plus: Release 10.1.0.5.0 - Production on Fri Feb 5 18:20:42 2010 Copyright (c) 1982, ...
Created by Dr. Xi on February 06, 2010 00:15:01
This query lists the tablespaces in Oracle: SQL> select * from v$tablespace; TS# NAME INC BIG FLA ENC ---------- ------------------------------ --- --- --- --- 0 SYSTEM YES NO YES 1 UNDO YES NO YES 2 SYSAUX YES NO YES 4 USERS YES NO YES 3 TEMP NO NO YES SQL>
Created by Dr. Xi on February 05, 2010 23:53:17
SQL> select sys_context('userenv', 'current_schema') from dual; SYS_CONTEXT('USERENV','CURRENT_SCHEMA') ------------------------------------------------------------------------------- JPA SQL> alter session set current_schema = sys; Session altered. SQL> select sys_context('userenv', 'current_schema') from dual; SYS_CONTEXT('USERENV','CURRENT_SCHEMA') ------------------------------------------------------------------------------- SYS SQL>
Created by Dr. Xi on February 04, 2010 00:21:05    Last update: February 04, 2010 00:22:09
The table DBA_DATA_FILES contains information about data files used in an Oracle database. The table DBA_SEGMENTS describes the storage allocated for all segments in the database. SQL> select sum(bytes)/1024/1024 SIZE_MB from dba_data_files; SIZE_MB ---------- 905 SQL> select sum(bytes)/1024/1024 SIZE_MB from dba_segments; SIZE_MB ---------- 646.375 SQL>
Created by voodoo on February 03, 2010 23:14:54
This is a workaround for a Windows security bug which existed since Windows NT 3.1. The problem is caused by flaws in the Virtual DOS Machine (VDM). Create a file with the follwoing contents and double click on the file to import into the registry. This disables the MS-DOS subsystem. Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\AppCompat] "VDMDisallowed"=dword:00000001
Created by Dr. Xi on February 03, 2010 19:32:30    Last update: February 04, 2010 16:30:49
This happens when you don't have connectivity to the Oracle server. This could be that the server is not up or you are blocked because of some firewall rules. A typical session looked like this: C:\>sqlplus scott/tiger@xe SQL*Plus: Release 10.1.0.5.0 - Production on Wed Feb 3 13:27:41 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. ERROR: ORA-12170: TNS:Connect timeout occurred Enter user-name: scott@xe Enter password: ERROR: ORA-12170: TNS:Connect timeout occurred Use tnsping to confirm the cause: C:\>tnsping xe TNS Ping Utility for 32-bit Windows: Version 10.1.0.5.0 - Production on 03-FEB-2 010 11:54:02 Copyright (c) 1997, 2003, Oracle. All rights reserved. Used parameter files: C:\work\globaltnsnames\sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP) (Host ...
Created by Dr. Xi on February 03, 2010 19:26:35    Last update: February 04, 2010 16:53:04
This seemed to happen when Oracle does not know which instance to connect to. Instead of telling you that you didn't give enough information, Oracle decides that you are better informed by telling you that it's a "protocol adapter error". In the following I didn't give the SID, nor did I set LOCAL: C:\>sqlplus scott/tiger SQL*Plus: Release 10.1.0.5.0 - Production on Wed Feb 3 11:52:43 2010 Copyright (c) 1982, 2005, Oracle. All rights reserved. ERROR: ORA-12560: TNS:protocol adapter error Enter user-name: ERROR: ORA-12560: TNS:protocol adapter error Enter user-name: ERROR: ORA-12560: TNS:protocol adapter error SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus It does seem to give the right information on Linux: $ sqlplus scott/tiger SQL*Plus: Release 10.1.0.5.0 - Production on Thu Feb ...
Created by Dr. Xi on February 03, 2010 17:44:14
When you start sqlplus withoud SID, Oracle says that you connect to the default database you created during installation. What if I installed multiple databases and I forgot which one is default? Is there a way to find out which is the current default? I wasn't able to find an answer. But there are a couple of ways to change the default by setting a couple of environment variables. The bad news is: the variables are different depending on which platform you are on. Unix If you are on Unix and the database is local, set these two variables: export ORACLE_HOME=/app/oracle/product/10.2.0/db_1 export ORACLE_SID=orcl If the database is remote, set TWO_TASK : export TWO_TASK=orcl Windows If you are on Windows, set LOCAL : set LOCAL=orcl Of ...
Created by woolf on February 03, 2010 04:39:18
Ways to use JavaScript date function: // current time new Date(); new Date(0); // Wed Dec 31 1969 18:00:00 GMT-0600 new Date(0).toUTCString(); // Thu, 01 Jan 1970 00:00:00 GMT // this format is locale specific new Date('12/23/2009'); // Wed Dec 23 2009 00:00:00 GMT-0600 // does this make sense? new Date('22/99/2009'); // Fri Jan 07 2011 00:00:00 GMT-0600 // initialize with long string new Date('Fri Jan 07 2011 12:59:'); // Fri Jan 07 2011 12:59:00 GMT-0600 // initialize with year, month, day, hour, etc... new Date(2009, 12, 23, 15); // Sat Jan 23 2010 15:00:00 GMT-0600 new Date(2009, 12, 23, 75); // Tue Jan 26 2010 03:00:00 GMT-0600 // 3 hours from now new Date(new Date().getTime() + 3 * 3600 * 1000);
Previous  1 2 3 4 5 6 7 8 9 10 Next