Not exactly. Oracle accommodates both byte semantics and character semantics for VARCHAR. The default for character types is byte semantics; a column defined as VARCHAR2(10)
holds 10 bytes, which might not be the same as 10 characters. The default for new columns is controlled by the parameter NLS_LENGTH_SEMANTICS.
But in a UTF-8 database, you can define a column as VARCHAR2(10 CHAR)
, which will hold 10 characters. Even if five of them are single-byte characters and five of them are multi-byte characters, all 10 will fit.
NCHAR and NVARCHAR2 always use character semantics. A column of NVARCHAR(20)
will hold 20 characters, but it might take 60 bytes to hold all of them.
NVARCHAR2 is limited to 4000 bytes, which is 4000 single-byte characters, but only a third that many multi-byte characters. (Assuming a maximum of three bytes per character.)
Disk space is much less expensive than it used to be. But you still have to get data off the disk for it to be useful. More bytes, more time; more time, more expense. IME, cost of disk space doesn't matter only to people who don't have to pay for it.
More details in Oracle Database Concepts.
This assumes that you've already partitioned the presented disk(s) (and will be using /dev/sd[whatever]N
), and that you're using asmlib
. There will be a kernel module loaded if you are:
[root@oel61 disks]# lsmod | grep oracle
oracleasm 53865 1
[root@oel61 disks]#
As root, scan for candidate disks:
[root@oel61 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@oel61 ~]#
Then, check to see if the disk has already been "discovered" by ASM:
oracle@oel61 ~]$ asmcmd -p
ASMCMD [+] > lsdsk
Path
/dev/oracleasm/disks/DISK1
/dev/oracleasm/disks/DISK2
/dev/oracleasm/disks/DISK3
ASMCMD [+] >
If not, we need to stamp the device:
[root@oel61 ~]# /etc/init.d/oracleasm createdisk NEWFRA /dev/sdc1
Marking disk "NEWFRA" as an ASM disk: [ OK ]
[root@oel61 ~]#
Scan for candidate disks again, then list - the new device should be there:
[root@oel61 ~]# /etc/init.d/oracleasm scandisks
Scanning the system for Oracle ASMLib disks: [ OK ]
[root@oel61 ~]#
# /etc/init.d/oracleasm listdisks
DISK1
DISK2
DISK3
NEWFRA
#
Or use asmcmd
:
oracle@oel61 ~]$ asmcmd -p
ASMCMD [+] > lsdsk
Path
/dev/oracleasm/disks/DISK1
/dev/oracleasm/disks/DISK2
/dev/oracleasm/disks/DISK3
/dev/oracleasm/disks/NEWFRA
ASMCMD [+] >
Now do a scandisks on the other node and check that everything is as it is on the first node (should be fine if you're using the same /dev device names).
Now the disk is ready to be added to the group.
List the groups:
[oracle@oel61 ~]$ export ORACLE_SID="+ASM"
[oracle@oel61 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.2.0 Production on Thu Jan 31 15:35:27 2013
Copyright (c) 1982, 2010, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Automatic Storage Management option
SQL> select name
2 from V$ASM_DISKGROUP;
NAME
------------------------------
DATA
FRA
SQL>
Add disk to the group:
SQL> ALTER DISKGROUP FRA ADD DISK '/dev/oracleasm/disks/NEWFRA';
Best Answer
You can use the
VSIZE
to get the number of bytes for the internal representation of a value.If you want the total space used by a column, you'll need to sum over all the rows (unless the type used has a fixed length).
The
DUMP
function will also give you the size and raw representation of a value, but not in a format amenable to easy summation.