The CreatorCon Call for Content is officially open! Get started here.

How to check disk space in My Instance

wirachat
Giga Contributor

Dear My Friend,

My boss has requested the available disk in ServiceNow instance. I don't know how to check disk space in my Instance or in web site ServiceNow Hi-Service.

We know Service has assigned space for My Instance 4 TB. My Boss need to know the available space and If the space nearing space full how to do in next step.

1.   ServiceNow will send notify before storage full right ?

2.   If the ServiceNow Instance has been full. ServiceNow will extent temporary desk for Company able to use ServiceNow or We need to contact ServiceNow's Sale team to urgent order.

Best Regards

Wirachat Ngamphiw

11 REPLIES 11

drjohnchun
Tera Guru

Wirachat - this is late in coming, but wanted to share what I posted in another thread just in case you may still be able to use the solution. One way to get table / database size is to use gs.sql(), if you're on Fuji or earlier release (it no longer works from Geneva):



gs.sql("SELECT CONCAT('YOUR INSTANCE DATABASE IS CURRENTLY ', ROUND(SUM(data_length + index_length) / 1024 / 1024 / 1024, 1), ' GB') DB_SIZE_GB FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE'");



gives (based on table sizes; took 180 ms)



DB_SIZE_GB


YOUR INSTANCE DATABASE IS CURRENTLY 2.8 GB



To get the size per table for all tables, with the largest first, use



gs.sql("SELECT TABLE_NAME, TABLE_ROWS, ROUND(((data_length + index_length) / 1024 / 1024), 2) TABLE_SIZE_MB FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE TABLE' ORDER BY 3 DESC");



gives (took 308 ms)



TABLE_NAME, TABLE_ROWS, TABLE_SIZE_MB


sys_upgrade_history_log, 340131, 1458.94


sys_attachment_doc, 20109, 220.16


sys_user_token, 149572, 82.78


sys_audit, 55394, 61.13


syslog_transaction0006, 72771, 59.75


syslog_transaction0002, 65791, 56.73


syslog_transaction0003, 68679, 56.73


syslog_transaction0004, 57225, 55.67


sys_metadata, 72777, 53.97


syslog_transaction0005, 58621, 51.81


usageanalytics_count, 35119, 40.75


syslog_transaction0001, 42843, 38.75


syslog_transaction0007, 34261, 31.80


...



To use gs.sql(), you have to elevate privilege to security_admin and use "Scripts - Background" from the Navigator.


WARNING: misuse of gs.sql() may cause unrecoverable damage to your instance.


Please feel free to connect, follow, mark helpful / answer, like, endorse.


John Chun, PhD PMP see John's LinkedIn profile


visit snowaid


Let me remind you that the use of gs.sql has been discouraged and actually doesn't work on last release, as you will get:



[0:00:00.006] Script completed in scope global: script



Security restricted: Calling gs.sql is not allowed