I am trying to get the size of all tablespaces on an Oracle database.
I have tried 2 ways of getting the info.
Option 1 gives me good values, but it doesn't give return any values when the tablespace doesn't have a database file. Specifically, it isn't returning any values for the "TEMP" and "TESTTODELETE" tablespaces.
The only differences I've noticed between these 2 tablespaces and the others are that these 2 don't have .dbf files.
Option 2 gives me the correct values for some tablespaces, but is totally off other times. Option 2 does return something for the "TEMP" tablespace, but it doesn't return anything for the "TESTTODELETE" tablespace.
Both options don't return any information for the tablespace "TESTTODELETE".
What is the best way to get the tablespace total size in MB for all tablespaces so that it reflects what is displayed in the Enterprise Manager?
dba_data_files contains just that, tablespaces that have data files. If you need to include tablespaces that aren't backed by data files (e.g. temp tablespaces), you'll need to include dba_temp_files in your query. They have almost exactly the same column layout so it should be easy to UNION them together.
As for dba_tablespace_usage_metrics, the capacity it reports is the maximum size for a tablespace. If a tablespace has autoextend enabled it will include that in the calculation. Furthermore, I don't recommend relying on the v$parameters to determine block size. Instead, join to dba_tablespaces because each tablespace can have its own block size.
Related
I want to create tablespace in ASM in Oracle rac db create tablespace <tablespacexxx> DATAFILE '+data';. data is one disk storage. I saw there are multiple disk groups when executing select * from V$ASM_DISKGROUP;
There is one disk group called Data and another group called Reco. The voting_files column for the two groups is different. voting_files for Data is set to y, and voting_files for Reco is set no n. I am wondering what are the differences between the two, and can I use either one to create tablespaces?
Use +DATA for your datafiles. +RECO or +FRA should be for the fast recovery area, online redo logs, voting files, and control files.
The Fast Recovery Area is Oracle-managed disk space that provides a
centralized disk location for backup and recovery files.
https://docs.oracle.com/en/database/oracle/oracle-database/19/haovw/oracle-database-configuration-best-practices.html#GUID-DB511B6A-D220-4556-B31B-18E3D310BA61
https://docs.oracle.com/en/database/oracle/oracle-database/19/ostmg/create-diskgroups.html#GUID-CACF13FD-1CEF-4A2B-BF17-DB4CF0E1800C
According to the disk group names, DATA is supposed to be contain user data, and RECO is to store the recovery logs. It more like an agreement among the developers and DBAs.
So, your new tablespace needs to placed at DATA.
Voting disks manage information about RAC node membership. You should not use it store any user data.
I'm running Oracle 11g XE on Debian Linux and I really need to know when "user data" is come close to 11 Gb.
The maximum amount of user data in an Oracle Database XE database cannot exceed 11 gigabytes. If the user data grows beyond this limit, then an ORA-12592 error will appear.
(c) docs.oracle.com
Few questions here:
what is user data exactly?
Which tablespaces is count as userdata?
Does system tablespaces like sysaux counts as user data?
Does separate files like archived redo logs counts as userdata?
Thank for help, guys, I'm really confused.
User data is the persistent data your application creates and uses, as distinct from the metadata the database generates itself (such as the data dictionary).
The tablespaces you need to monitor are USERS and any other tablespace you have created. The tablespaces SYS and SYSAUX are reserved for the database's own data and so don't count; TEMP and UNDO (or whatever else you call your temporary and rollback tablespaces) don't count either.
Redo logs and other files are external to the database and so don't count either.
Im Using Windows Server 2008 R2 Standard
Im Running PostgreSQL 9.0.1, compiled by Visual C++ build 1500, 32-bit
I got C:/ and D:/ Drive
C:/ --> 6.7GB free space (almost full and my server performance running low)
D:/ --> 141GB free space
Currently my PostgreSQL Data stored at C:/ Now,I want to route or add path to D:/ without migrate the data from C:/ to D:/ because now my PostgreSQL Data Stored around 148 GB. It Heavy and Massive Stored.
If success, I should still be able to do a query like SELECT * From table_bla_bla and it will return result from both drives?
Please do not suggest me to change PostgreSQL to other DB or whatsoever.
Because Im running 39,763 Device GPS Meter that send the data to my Server.
I have to take care this server because my expert already past-away.
You need to use tablespaces.
Create the tablespace, for example CREATE TABLESPACE second_drive LOCATION 'D:/postgresdata/' (see this other answer if you get permission denied errors)
ALTER TABLE table_bla_bla SET tablespace second_drive
Tablespaces allow you to decide which tables go on which drives and that can help speed up performance by ensuring you control where reads and writes go, but it also helps with space.
Postgres places individual tables in TABLESPACEs (which relate to a single disk), which is enough if you have multiple tables and you can achieve what you need by moving some tables to the other disk.
On the other hand, if you have a large table that you need to split over multiple disks, you need to use Postgres's Horizontal Partitioning capability.
This builds on tablespaces by allowing you to create a master table table_bla_bla which is actually just a facade on top of two or more tables which actually hold the data. These data tables can then be put on different tablesspaces effectively splitting your data over disks.
For this you would:
Rename your current table_bla_bla to something like
table_bla_bla_c
Create a new table_bla_bla master table.
Alter table_bla_bla_c to mark that it inherits from
table_bla_bla
Create a new table_bla_bla_d table that inherits from table_bla_bla and specify the tablespace as the D drive.
Apply partitioning triggers and check constraints as per the partitioning documentation
Once this is in place, you can arrange it so that any inserts into table_bla_bla cause new records to be created on the D drive. Selects on table_bla_bla will read from both disks.
My current task is to create a .bat file that can manually create an Oracle database, so that a Database Configuration Assistant is no longer necessary.
I am following this guide.
I am stuck at "Creating the database". Upon typing:
SQL> create database ORA10
I do not get the expected output as described on the guide:
SQL>create database ora10
logfile group 1 ('D:\oracle\databases\ora10\redo1.log') size 10M,
group 2 ('D:\oracle\databases\ora10\redo2.log') size 10M,
group 3 ('D:\oracle\databases\ora10\redo3.log') size 10M
character set WE8ISO8859P1
national character set utf8
datafile 'D:\oracle\databases\ora10\system.dbf'
size 50M
autoextend on
next 10M maxsize unlimited
extent management local
sysaux datafile 'D:\oracle\databases\ora10\sysaux.dbf'
size 10M
autoextend on
next 10M
maxsize unlimited
undo tablespace undo
datafile 'D:\oracle\databases\ora10\undo.dbf'
size 10M
default temporary tablespace temp
tempfile 'D:\oracle\databases\ora10\temp.dbf'
size 10M;
Instead I get a bunch of numbered input requests:
SQL> create database ORA10
2 and
3 it
4 doesn't
5 seem
6 to
7 stop
8 asking
9 for
10 inputs
Other sources/guides I've googled look similar to the aforementioned guide. As far as I know (I might not be using the right keywords), my output is not supposed to happen. I am unable to identify what is going on here.
Please note that I don't actually know much about SQL or using command prompt. My background is limited to classroom HTML/CSS/Java/Python. I have been dared to complete a number of programming related tasks within a certain period of time (a week) without any instruction or preparation - though I am allowed to use the internet for assistance. So far so good until now.
Any assistance will be appreciated, thank you in advance.
All the lines in your listing from create database ORA10 to size 10M; including the last semicolon are not output, but instead part of one single statement. The semicolon terminates it and tells the command interpreter to execute what you've written. Therefore it is continuing to ask you for input until you tell it you're done (with the semicolon).
If you simply want to create a database without specifying any other options, you can simply add a semicolon. The following will create a database with the name "ORA10" in the default configuration:
CREATE DATABASE ORA10;
I recently perform a purging on my application table. total record of 1.1 millions with the disk space used 11.12GB.
I had deleted 860k records and remain 290k records, but why my space used only drop to 11.09GB?
I monitor the detail on report - disk usage - disk space used by data files - space used.
Is it that i need to perfrom shrink data file? This has been puzzle me long time.
For MS SQL Server, rebuild the clustered indexes.
You have only deleted rows: not reclaimed space.
DBCC DBREINDEX or ALTER INDEX ... WITH REBUILD depending on verison
(It's MS SQL because the disk space report is in SSMS)
You need to explicitly call some operation (specific to your database management system) that will shrink the data file. The database engine doesn't shrink the file when you delete records, that's for optimization purposes - shrinking is time-consuming.
I think this is like with mail folders in Thunderbird: If you delete something, it's just marked as deleted, but to get higher performance, the space isn't freed. So most of your 11.09 GB will now contain either your old data or 0's. Shrink data file will "compress" (or "clean") this by creating a new file that'll only contain the actual data that is left.
Probably you need to shrink the table. I know that SQL server doesn't do it by default for you, I would guess this is for reasons of performance, maybe other DBs are the same.